summaryrefslogtreecommitdiff
path: root/bot/src
diff options
context:
space:
mode:
Diffstat (limited to 'bot/src')
-rw-r--r--bot/src/commands/lua.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/bot/src/commands/lua.cpp b/bot/src/commands/lua.cpp
index 783b48b..22233bb 100644
--- a/bot/src/commands/lua.cpp
+++ b/bot/src/commands/lua.cpp
@@ -27,6 +27,7 @@
#include "cpr/cprtypes.h"
#include "cpr/multipart.h"
#include "cpr/response.h"
+#include "schemas/channel.hpp"
#include "schemas/user.hpp"
#include "utils/chrono.hpp"
#include "utils/string.hpp"
@@ -365,6 +366,16 @@ namespace bot::command::lua {
[](const std::string &text, const char &delimiter) {
return utils::string::split_text(text, delimiter);
});
+
+ state->set_function(
+ "str_to_feature", [state](const std::string &feature) {
+ auto f = schemas::string_to_channel_feature(feature);
+ if (f.has_value()) {
+ return sol::make_object(*state, (int)f.value());
+ } else {
+ return sol::make_object(*state, sol::lua_nil);
+ }
+ });
}
void add_db_library(std::shared_ptr<sol::state> state,