summaryrefslogtreecommitdiff
path: root/discord/discord.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2020-09-20 01:12:54 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2020-09-20 01:12:54 -0400
commit4b7cdbd129cedd4029c2b99c85146ad5e07e9732 (patch)
tree955341fa06c7d54b1449a491c5291ddd3e9830c2 /discord/discord.cpp
parent83b480742b46f120b73042791e2f91c70ce3fe84 (diff)
downloadabaddon-portaudio-4b7cdbd129cedd4029c2b99c85146ad5e07e9732.tar.gz
abaddon-portaudio-4b7cdbd129cedd4029c2b99c85146ad5e07e9732.zip
improve MESSAGE_UPDATE handling (hopefully)
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r--discord/discord.cpp14
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) {