diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-02-28 01:44:31 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-02-28 01:44:31 -0500 |
commit | 11358da24e0e73044aed389b1dbbf479808ca036 (patch) | |
tree | 8133a877286e5d4c3f8c77e96fa7213a4468111b /discord/discord.cpp | |
parent | e81fdf1c3619392b41b66d87a7a6d3de0ca85ff7 (diff) | |
download | abaddon-portaudio-11358da24e0e73044aed389b1dbbf479808ca036.tar.gz abaddon-portaudio-11358da24e0e73044aed389b1dbbf479808ca036.zip |
handle UPDATE in GUILD_MEMBER_LIST_UPDATE
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r-- | discord/discord.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp index f0254e3..fbe6549 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -1303,7 +1303,7 @@ void DiscordClient::HandleGatewayGuildMemberListUpdate(const GatewayMessage &msg for (const auto &op : data.Ops) { if (op.Op == "SYNC") { has_sync = true; - for (const auto &item : op.Items) { + for (const auto &item : *op.Items) { if (item->Type == "member") { auto member = static_cast<const GuildMemberListUpdateMessage::MemberItem *>(item.get()); m_store.SetUser(member->User.ID, member->User); @@ -1322,6 +1322,12 @@ void DiscordClient::HandleGatewayGuildMemberListUpdate(const GatewayMessage &msg } } } + } else if (op.Op == "UPDATE") { + if (op.OpItem.has_value() && op.OpItem.value()->Type == "member") { + const auto &m = static_cast<const GuildMemberListUpdateMessage::MemberItem *>(op.OpItem.value().get())->GetAsMemberData(); + m_store.SetGuildMember(data.GuildID, m.User->ID, m); + m_signal_guild_member_update.emit(data.GuildID, m.User->ID); // cheeky + } } } |