diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Discord/src/guilds.cpp | 14 | ||||
-rw-r--r-- | protocols/Discord/src/version.h | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp index 7178fe7203..267084b60a 100644 --- a/protocols/Discord/src/guilds.cpp +++ b/protocols/Discord/src/guilds.cpp @@ -278,10 +278,12 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS ///////////////////////////////////////////////////////////////////////////////////////// -CDiscordGuildMember* CDiscordProto::ProcessGuildUser(CDiscordGuild *pGuild, const JSONNode &pUser, bool *pbNew) +CDiscordGuildMember* CDiscordProto::ProcessGuildUser(CDiscordGuild *pGuild, const JSONNode &pRoot, bool *pbNew) { + auto& pUser = pRoot["user"]; + bool bNew = false; - CMStringW wszUserId = pUser["user"]["id"].as_mstring(); + CMStringW wszUserId = pUser["id"].as_mstring(); SnowFlake userId = _wtoi64(wszUserId); CDiscordGuildMember *pm = pGuild->FindUser(userId); if (pm == nullptr) { @@ -290,13 +292,17 @@ CDiscordGuildMember* CDiscordProto::ProcessGuildUser(CDiscordGuild *pGuild, cons bNew = true; } - pm->wszNick = pUser["user"]["username"].as_mstring() + L"#" + pUser["user"]["discriminator"].as_mstring(); + pm->wszNick = pRoot["nick"].as_mstring(); + if (pm->wszNick.IsEmpty()) + pm->wszNick = pUser["username"].as_mstring() + L"#" + pUser["discriminator"].as_mstring(); + else + bNew = true; if (userId == pGuild->ownerId) pm->wszRole = L"@owner"; else { CDiscordRole *pRole = nullptr; - for (auto &itr : pUser["roles"]) { + for (auto &itr : pRoot["roles"]) { SnowFlake roleId = ::getId(itr); if (pRole = pGuild->arRoles.find((CDiscordRole *)&roleId)) break; diff --git a/protocols/Discord/src/version.h b/protocols/Discord/src/version.h index f251323329..d054be3648 100644 --- a/protocols/Discord/src/version.h +++ b/protocols/Discord/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 6 #define __RELEASE_NUM 2 -#define __BUILD_NUM 10 +#define __BUILD_NUM 11 #include <stdver.h> |