diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-03-08 19:21:02 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-03-08 19:21:02 -0500 |
commit | 816f1a01ecc3155ad410d1ff34510b558e2d8cbf (patch) | |
tree | d2cacbc4f3c4ada38704abc054fa1b9422bc4074 | |
parent | 0620e51617a88cc46584766e4919176f92f50ffa (diff) | |
download | abaddon-portaudio-816f1a01ecc3155ad410d1ff34510b558e2d8cbf.tar.gz abaddon-portaudio-816f1a01ecc3155ad410d1ff34510b558e2d8cbf.zip |
handle notification level 3
-rw-r--r-- | src/discord/objects.hpp | 1 | ||||
-rw-r--r-- | src/notifications/notifications.cpp | 23 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/discord/objects.hpp b/src/discord/objects.hpp index 97da807..d7db55b 100644 --- a/src/discord/objects.hpp +++ b/src/discord/objects.hpp @@ -276,6 +276,7 @@ enum class NotificationLevel { ALL_MESSAGES = 0, ONLY_MENTIONS = 1, NO_MESSAGES = 2, + USE_UPPER = 3, // actually called "NULL" }; struct UserGuildSettingsChannelOverride { diff --git a/src/notifications/notifications.cpp b/src/notifications/notifications.cpp index bda9f46..db06651 100644 --- a/src/notifications/notifications.cpp +++ b/src/notifications/notifications.cpp @@ -44,14 +44,29 @@ bool CheckGuildMessage(const Message &message) { const auto channel_settings = guild_settings->GetOverride(message.ChannelID); - // if there are guild settings but no channel settings then fallback to category or guild - + // 🥴 NotificationLevel level; if (channel_settings.has_value()) { - level = channel_settings->MessageNotifications; + if (channel_settings->MessageNotifications == NotificationLevel::USE_UPPER) { + if (category_settings.has_value()) { + if (category_settings->MessageNotifications == NotificationLevel::USE_UPPER) { + level = guild_settings->MessageNotifications; + } else { + level = category_settings->MessageNotifications; + } + } else { + level = guild_settings->MessageNotifications; + } + } else { + level = channel_settings->MessageNotifications; + } } else { if (category_settings.has_value()) { - level = category_settings->MessageNotifications; + if (category_settings->MessageNotifications == NotificationLevel::USE_UPPER) { + level = guild_settings->MessageNotifications; + } else { + level = category_settings->MessageNotifications; + } } else { level = guild_settings->MessageNotifications; } |