1
0
Fork 0
mirror of https://gitlab.com/niansa/SomeBot.git synced 2025-03-06 20:48:26 +01:00

Further bindings

This commit is contained in:
niansa 2023-03-02 18:43:06 +01:00
parent 5cf9b7df36
commit 9ed6fafe70

View file

@ -21,8 +21,16 @@ class LuaExecution {
return 1;
}
struct BaseContext {
dpp::snowflake guild_id;
Bot *bot;
} baseContext;
struct Context : public BaseContext {
dpp::message *msg;
};
public:
LuaExecution() : state(luaL_newstate(), lua_close) {
LuaExecution(Bot *bot, dpp::snowflake guild_id) : state(luaL_newstate(), lua_close), baseContext{guild_id, bot} {
// Set assertion handler
Luau::assertHandler() = assertionHandler;
@ -34,6 +42,13 @@ public:
using namespace dpp;
luabridge::getGlobalNamespace(state)
.beginClass<Context>("Context")
.addProperty("guild_id", &Context::guild_id, false)
.addProperty("bot", &Context::bot, false)
.endClass()
.beginClass<Bot>("Bot")
//.addFunction()
.endClass()
.beginClass<snowflake>("Snowflake")
.addConstructor<void (const uint64_t&), void (const std::string&)>()
.addProperty("id", &snowflake::operator unsigned long)
@ -164,6 +179,32 @@ public:
.addProperty("ephemeral", &attachment::ephemeral, true)
.addProperty("owner", &attachment::owner, false)
.endClass()
.beginClass<sticker>("Sticker")
.addProperty("id", &sticker::id, false)
.addProperty("pack_id", &sticker::pack_id, true)
.addProperty("name", &sticker::name, true)
.addProperty("description", &sticker::description, true)
.addProperty("tags", &sticker::tags, true)
.addProperty("asset", &sticker::asset, true)
.addProperty("type", &sticker::type, true)
.addProperty("format_type", &sticker::format_type, true)
.addProperty("available", &sticker::available, true)
.addProperty("guild_id", &sticker::guild_id, false)
.addProperty("sticker_user", &sticker::sticker_user, false)
.addProperty("sort_value", &sticker::sort_value, true)
.addProperty("file_name", &sticker::filename, true)
.addProperty("file_content", &sticker::filecontent, true)
.addFunction("get_url", &sticker::get_url)
.endClass()
.beginClass<sticker_pack>("StickerPack")
.addProperty("id", &sticker_pack::id, false)
.addProperty("stickers", &sticker_pack::stickers, true)
.addProperty("name", &sticker_pack::name, true)
.addProperty("description", &sticker_pack::description, true)
.addProperty("sku_id", &sticker_pack::sku_id, true)
.addProperty("cover_sticker_id", &sticker_pack::cover_sticker_id, true)
.addProperty("banner_asset_id", &sticker_pack::banner_asset_id, true)
.endClass()
.beginClass<channel>("Channel")
.addProperty("id", &channel::id, false)
.addProperty("name", &channel::name, true)