diff options
| author | ilotterytea <iltsu@alright.party> | 2025-07-02 03:32:50 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-07-02 03:32:50 +0500 |
| commit | 94fede466d8d77f53e5c49215fc8ad99a30610f9 (patch) | |
| tree | 94586a05474481faa9fbb0bb99f0cc90f9004fe7 | |
| parent | 79be89ad0491bfdd110b2c612e21a0f28c29fa87 (diff) | |
feat: silent mode in features
| -rw-r--r-- | bot/src/schemas/channel.cpp | 4 | ||||
| -rw-r--r-- | bot/src/schemas/channel.hpp | 10 | ||||
| -rw-r--r-- | luamods/join.lua | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/bot/src/schemas/channel.cpp b/bot/src/schemas/channel.cpp index 540b7c0..ee0597b 100644 --- a/bot/src/schemas/channel.cpp +++ b/bot/src/schemas/channel.cpp @@ -9,6 +9,8 @@ namespace bot::schemas { return MARKOV_RESPONSES; } else if (value == "random_markov_responses") { return RANDOM_MARKOV_RESPONSES; + } else if (value == "silent_mode") { + return SILENT_MODE; } else { return std::nullopt; } @@ -21,6 +23,8 @@ namespace bot::schemas { return "markov_responses"; case RANDOM_MARKOV_RESPONSES: return "random_markov_responses"; + case SILENT_MODE: + return "silent_mode"; default: std::nullopt; } diff --git a/bot/src/schemas/channel.hpp b/bot/src/schemas/channel.hpp index a8979ec..c2ac5e2 100644 --- a/bot/src/schemas/channel.hpp +++ b/bot/src/schemas/channel.hpp @@ -50,9 +50,13 @@ namespace bot::schemas { std::optional<std::chrono::system_clock::time_point> opted_out_at; }; - enum ChannelFeature { MARKOV_RESPONSES, RANDOM_MARKOV_RESPONSES }; - const std::vector<ChannelFeature> FEATURES = {MARKOV_RESPONSES, - RANDOM_MARKOV_RESPONSES}; + enum ChannelFeature { + MARKOV_RESPONSES, + RANDOM_MARKOV_RESPONSES, + SILENT_MODE + }; + const std::vector<ChannelFeature> FEATURES = { + MARKOV_RESPONSES, RANDOM_MARKOV_RESPONSES, SILENT_MODE}; std::optional<ChannelFeature> string_to_channel_feature( const std::string &value); std::optional<std::string> channelfeature_to_string( diff --git a/luamods/join.lua b/luamods/join.lua index e663c96..e18660c 100644 --- a/luamods/join.lua +++ b/luamods/join.lua @@ -104,7 +104,7 @@ return { ) else local db_channel = db_query('SELECT id FROM channels WHERE alias_id = $1', { channel_id })[1] - db_execute('INSERT IGNORE INTO channel_preferences(channel_id, is_channel_silenced) VALUES ($1, $2)', + db_execute('INSERT IGNORE INTO channel_preferences(id, silent_mode) VALUES ($1, $2)', { db_channel.id, silent_mode }) end |
