summaryrefslogtreecommitdiff
path: root/bot
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-12-14 23:11:49 +0500
committerilotterytea <iltsu@alright.party>2024-12-14 23:11:49 +0500
commitb96792078a350b02c6d3e650bbe5c42b665bee7e (patch)
treebaeceb8d4891ab9a6be8f241d310277104c0839d /bot
parent6504ce844023f188dfb5350cd8ad34bfc94f5ac0 (diff)
feat: a method for converting strings to ChannelFeature
Diffstat (limited to 'bot')
-rw-r--r--bot/src/schemas/channel.cpp14
-rw-r--r--bot/src/schemas/channel.hpp2
2 files changed, 16 insertions, 0 deletions
diff --git a/bot/src/schemas/channel.cpp b/bot/src/schemas/channel.cpp
new file mode 100644
index 0000000..ae4ea53
--- /dev/null
+++ b/bot/src/schemas/channel.cpp
@@ -0,0 +1,14 @@
+#include "channel.hpp"
+
+namespace bot::schemas {
+ std::optional<ChannelFeature> string_to_channel_feature(
+ const std::string &value) {
+ if (value == "markov_responses") {
+ return MARKOV_RESPONSES;
+ } else if (value == "random_markov_responses") {
+ return RANDOM_MARKOV_RESPONSES;
+ } else {
+ return std::nullopt;
+ }
+ }
+} \ No newline at end of file
diff --git a/bot/src/schemas/channel.hpp b/bot/src/schemas/channel.hpp
index ace4c4d..08ed8ad 100644
--- a/bot/src/schemas/channel.hpp
+++ b/bot/src/schemas/channel.hpp
@@ -48,6 +48,8 @@ namespace bot::schemas {
};
enum ChannelFeature { MARKOV_RESPONSES, RANDOM_MARKOV_RESPONSES };
+ std::optional<ChannelFeature> string_to_channel_feature(
+ const std::string &value);
class ChannelPreferences {
public: