blob: 7acc107c104dadb141842ef0772e93dc2450c01d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "commands/request.hpp"
#include <sol/types.hpp>
namespace bot::command {
sol::table Request::as_lua_table(std::shared_ptr<sol::state> luaState) const {
sol::table o = luaState->create_table();
o["command_id"] = this->command_id;
if (this->subcommand_id.has_value()) {
o["subcommand_id"] = this->subcommand_id.value();
} else {
o["subcommand_id"] = sol::lua_nil;
}
if (this->message.has_value()) {
o["message"] = this->message.value();
} else {
o["message"] = sol::lua_nil;
}
o["sender"] = this->user.as_lua_table(luaState);
o["channel"] = this->channel.as_lua_table(luaState);
o["channel_preference"] = this->channel_preferences.as_lua_table(luaState);
o["rights"] = this->user_rights.as_lua_table(luaState);
return o;
}
}
|