handle notification level 3

This commit is contained in:
ouwou
2023-03-08 19:21:02 -05:00
parent 0620e51617
commit 816f1a01ec
2 changed files with 20 additions and 4 deletions

View File

@@ -276,6 +276,7 @@ enum class NotificationLevel {
ALL_MESSAGES = 0,
ONLY_MENTIONS = 1,
NO_MESSAGES = 2,
USE_UPPER = 3, // actually called "NULL"
};
struct UserGuildSettingsChannelOverride {

View File

@@ -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;
}