summaryrefslogtreecommitdiff
path: root/bot/src/commands/lua.hpp
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-06 17:28:47 +0400
committerilotterytea <iltsu@alright.party>2025-04-06 17:28:47 +0400
commit2a49844a95593ac98e919c18651320e62f276fa7 (patch)
tree01b7e2ebb1dc7a9ac92e7c3105edfd098271f29a /bot/src/commands/lua.hpp
parenta1a36cf4d4999b5ce89dce95364c9fd839b54b5d (diff)
feat: implementing lua coding
Diffstat (limited to 'bot/src/commands/lua.hpp')
-rw-r--r--bot/src/commands/lua.hpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/bot/src/commands/lua.hpp b/bot/src/commands/lua.hpp
new file mode 100644
index 0000000..11e98d3
--- /dev/null
+++ b/bot/src/commands/lua.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include <sol/sol.hpp>
+#include <sol/state.hpp>
+#include <sol/table.hpp>
+#include <sol/types.hpp>
+#include <string>
+#include <vector>
+
+#include "commands/command.hpp"
+#include "commands/response.hpp"
+#include "schemas/user.hpp"
+
+void print_lua_object_type(const sol::object &obj);
+
+namespace bot::command::lua {
+ class LuaCommand : public Command {
+ public:
+ LuaCommand(std::shared_ptr<sol::state> luaState,
+ const std::string &content);
+ ~LuaCommand() = default;
+
+ Response run(const InstanceBundle &bundle,
+ const Request &request) const override;
+
+ std::string get_name() const override { return this->name; }
+ int get_delay_seconds() const override { return this->delay; }
+ schemas::PermissionLevel get_permission_level() const override {
+ return this->level;
+ }
+ std::vector<std::string> get_subcommand_ids() const override {
+ return this->subcommands;
+ }
+
+ private:
+ std::string name;
+ int delay;
+ schemas::PermissionLevel level;
+ std::vector<std::string> subcommands;
+
+ sol::function handle;
+
+ std::shared_ptr<sol::state> luaState;
+ };
+} \ No newline at end of file