Add discriminator to join request

This commit is contained in:
Chris Marsh 2017-11-30 11:22:23 -08:00 committed by Chris Marsh
parent c1a8899d02
commit 1a278528a2
2 changed files with 6 additions and 1 deletions

View file

@ -44,6 +44,7 @@ typedef struct DiscordRichPresence {
typedef struct DiscordJoinRequest {
const char* userId;
const char* username;
const char* discriminator;
const char* avatar;
} DiscordJoinRequest;

View file

@ -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();