From 2a49844a95593ac98e919c18651320e62f276fa7 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 6 Apr 2025 17:28:47 +0400 Subject: feat: implementing lua coding --- bot/src/commands/lua.hpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bot/src/commands/lua.hpp (limited to 'bot/src/commands/lua.hpp') 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 +#include +#include +#include +#include +#include + +#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 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 get_subcommand_ids() const override { + return this->subcommands; + } + + private: + std::string name; + int delay; + schemas::PermissionLevel level; + std::vector subcommands; + + sol::function handle; + + std::shared_ptr luaState; + }; +} \ No newline at end of file -- cgit v1.2.3