diff options
Diffstat (limited to 'src/discord')
-rw-r--r-- | src/discord/discord.cpp | 8 | ||||
-rw-r--r-- | src/discord/discord.hpp | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index af25b3a..b54064a 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -1095,6 +1095,10 @@ void DiscordClient::SetUserAgent(std::string agent) { m_websocket.SetUserAgent(agent); } +bool DiscordClient::IsChannelMuted(Snowflake id) const noexcept { + return m_muted_channels.find(id) != m_muted_channels.end(); +} + bool DiscordClient::IsGuildMuted(Snowflake id) const noexcept { return m_muted_guilds.find(id) != m_muted_guilds.end(); } @@ -2190,6 +2194,10 @@ void DiscordClient::HandleReadyGuildSettings(const ReadyEventData &data) { for (const auto &entry : data.GuildSettings.Entries) { if (entry.Muted) m_muted_guilds.insert(entry.GuildID); + for (const auto &override : entry.ChannelOverrides) { + if (override.Muted) + m_muted_channels.insert(override.ChannelID); + } } } diff --git a/src/discord/discord.hpp b/src/discord/discord.hpp index 4dc9520..fbee775 100644 --- a/src/discord/discord.hpp +++ b/src/discord/discord.hpp @@ -184,6 +184,7 @@ public: void UpdateToken(std::string token); void SetUserAgent(std::string agent); + bool IsChannelMuted(Snowflake id) const noexcept; bool IsGuildMuted(Snowflake id) const noexcept; int GetUnreadStateForChannel(Snowflake id) const noexcept; @@ -280,6 +281,7 @@ private: std::map<Snowflake, std::vector<Snowflake>> m_thread_members; std::map<Snowflake, Snowflake> m_last_message_id; std::unordered_set<Snowflake> m_muted_guilds; + std::unordered_set<Snowflake> m_muted_channels; std::unordered_map<Snowflake, int> m_unread; UserData m_user_data; |