summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/discord/objects.hpp1
-rw-r--r--src/notifications/notifications.cpp23
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;
}