From 1a278528a2315561f4121a8cb884354bf31cfa16 Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Thu, 30 Nov 2017 11:22:23 -0800 Subject: [PATCH] Add discriminator to join request --- include/discord-rpc.h | 1 + src/discord-rpc.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/discord-rpc.h b/include/discord-rpc.h index a81673e..8c117ac 100644 --- a/include/discord-rpc.h +++ b/include/discord-rpc.h @@ -44,6 +44,7 @@ typedef struct DiscordRichPresence { typedef struct DiscordJoinRequest { const char* userId; const char* username; + const char* discriminator; const char* avatar; } DiscordJoinRequest; diff --git a/src/discord-rpc.cpp b/src/discord-rpc.cpp index b231e88..fc2ad95 100644 --- a/src/discord-rpc.cpp +++ b/src/discord-rpc.cpp @@ -193,6 +193,10 @@ static void Discord_UpdateConnection(void) if (userId && username && joinReq) { StringCopy(joinReq->userId, userId); StringCopy(joinReq->username, username); + auto discriminator = GetStrMember(user, "discriminator"); + if (discriminator) { + StringCopy(joinReq->discriminator, discriminator); + } if (avatar) { StringCopy(joinReq->avatar, avatar); } @@ -380,7 +384,7 @@ extern "C" DISCORD_EXPORT void Discord_RunCallbacks() while (JoinAskQueue.HavePendingSends()) { auto req = JoinAskQueue.GetNextSendMessage(); if (Handlers.joinRequest) { - DiscordJoinRequest djr{req->userId, req->username, req->avatar}; + DiscordJoinRequest djr{req->userId, req->username, req->discriminator, req->avatar}; Handlers.joinRequest(&djr); } JoinAskQueue.CommitSend();