diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-01-09 02:10:48 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-01-09 02:10:48 -0500 |
commit | 4d62944dbb0fe2a803f94e05bddc67ef7c8947fe (patch) | |
tree | 48712a042f17cbb35116818b76bb1aab29d7366a /discord | |
parent | 117e5db5646ef74e7f09864d8450bac792e14923 (diff) | |
download | abaddon-portaudio-4d62944dbb0fe2a803f94e05bddc67ef7c8947fe.tar.gz abaddon-portaudio-4d62944dbb0fe2a803f94e05bddc67ef7c8947fe.zip |
fix channel/guild updates
Diffstat (limited to 'discord')
-rw-r--r-- | discord/discord.cpp | 1 | ||||
-rw-r--r-- | discord/guild.cpp | 5 |
2 files changed, 3 insertions, 3 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp index 72dba79..e5c739e 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -751,6 +751,7 @@ void DiscordClient::HandleGatewayGuildUpdate(const GatewayMessage &msg) { auto current = m_store.GetGuild(id); if (!current.has_value()) return; current->update_from_json(msg.Data); + m_store.SetGuild(id, *current); m_signal_guild_update.emit(id); } diff --git a/discord/guild.cpp b/discord/guild.cpp index 6b26f25..40762ad 100644 --- a/discord/guild.cpp +++ b/discord/guild.cpp @@ -141,10 +141,9 @@ std::vector<Snowflake> GuildData::GetSortedChannels(Snowflake ignore) const { std::map<int, std::vector<ChannelData>> orphan_channels; for (const auto &channel_id : channels) { const auto data = discord.GetChannel(channel_id); - if (!data.has_value()) continue; - if (!data->ParentID->IsValid() && (data->Type == ChannelType::GUILD_TEXT || data->Type == ChannelType::GUILD_NEWS)) + if (!data->ParentID.has_value() && (data->Type == ChannelType::GUILD_TEXT || data->Type == ChannelType::GUILD_NEWS)) orphan_channels[*data->Position].push_back(*data); - else if (data->ParentID->IsValid() && (data->Type == ChannelType::GUILD_TEXT || data->Type == ChannelType::GUILD_NEWS)) + else if (data->ParentID.has_value() && (data->Type == ChannelType::GUILD_TEXT || data->Type == ChannelType::GUILD_NEWS)) category_to_channels[*data->ParentID].push_back(*data); else if (data->Type == ChannelType::GUILD_CATEGORY) position_to_categories[*data->Position].push_back(*data); |