diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-20 01:12:54 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-20 01:12:54 -0400 |
commit | 4b7cdbd129cedd4029c2b99c85146ad5e07e9732 (patch) | |
tree | 955341fa06c7d54b1449a491c5291ddd3e9830c2 /discord/discord.cpp | |
parent | 83b480742b46f120b73042791e2f91c70ce3fe84 (diff) | |
download | abaddon-portaudio-4b7cdbd129cedd4029c2b99c85146ad5e07e9732.tar.gz abaddon-portaudio-4b7cdbd129cedd4029c2b99c85146ad5e07e9732.zip |
improve MESSAGE_UPDATE handling (hopefully)
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r-- | discord/discord.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp index 8e81e7f..e16e764 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -387,18 +387,16 @@ void DiscordClient::HandleGatewayMessageDelete(const GatewayMessage &msg) { } void DiscordClient::HandleGatewayMessageUpdate(const GatewayMessage &msg) { - // less than stellar way of doing this probably - Message data; - data.from_json_edited(msg.Data); + Snowflake id = msg.Data.at("id"); - auto *current = m_store.GetMessage(data.ID); + auto *current = m_store.GetMessage(id); if (current == nullptr) return; - if (data.Content != current->Content) { - current->SetEdited(data.Content); - m_signal_message_update.emit(data.ID, data.ChannelID); - } + current->from_json_edited(msg.Data); + + current->SetEdited(); + m_signal_message_update.emit(id, current->ChannelID); } void DiscordClient::HandleGatewayGuildMemberListUpdate(const GatewayMessage &msg) { |