diff options
| author | ilotterytea <iltsu@alright.party> | 2025-07-01 18:54:10 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-07-01 18:54:10 +0500 |
| commit | 8c2e0d8c1faabb76f2e75cddc8b7da2caabf8da6 (patch) | |
| tree | 5d227bd7529c0fa7e248737d430212275621bb93 /bot/src/commands | |
| parent | 25a25a07a7b68443791974800dbfc77d223392d6 (diff) | |
feat: KICK SUPPORT RAAAAH!!!! emojiAngry
Diffstat (limited to 'bot/src/commands')
| -rw-r--r-- | bot/src/commands/lua.cpp | 25 | ||||
| -rw-r--r-- | bot/src/commands/lua.hpp | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/bot/src/commands/lua.cpp b/bot/src/commands/lua.cpp index 90b734e..cb00887 100644 --- a/bot/src/commands/lua.cpp +++ b/bot/src/commands/lua.cpp @@ -17,6 +17,7 @@ #include <string> #include <vector> +#include "api/kick.hpp" #include "api/twitch/schemas/user.hpp" #include "bundle.hpp" #include "commands/request.hpp" @@ -610,6 +611,7 @@ namespace bot::command::lua { lua::library::add_bot_library(state, bundle); lua::library::add_irc_library(state, bundle); lua::library::add_twitch_library(state, request, bundle); + lua::library::add_kick_library(state, bundle); lua::library::add_db_library(state, bundle.configuration); lua::library::add_l10n_library(state, bundle); } @@ -702,6 +704,29 @@ namespace bot::command::lua { return o; }); } + + void add_kick_library(std::shared_ptr<sol::state> state, + const InstanceBundle &bundle) { + state->set_function( + "kick_get_channels", [state, &bundle](const std::string &slug) { + std::vector<api::KickChannel> channels = + bundle.kick_api_client.get_channels(slug); + + sol::table o = state->create_table(); + + std::for_each(channels.begin(), channels.end(), + [state, &o](const api::KickChannel &x) { + sol::table u = state->create_table(); + + u["id"] = x.broadcaster_user_id; + u["login"] = x.slug; + + o.add(u); + }); + + return o; + }); + } } Response parse_lua_response(const sol::table &r, sol::object &res, diff --git a/bot/src/commands/lua.hpp b/bot/src/commands/lua.hpp index 3d514f3..bde317b 100644 --- a/bot/src/commands/lua.hpp +++ b/bot/src/commands/lua.hpp @@ -28,6 +28,8 @@ namespace bot::command::lua { void add_twitch_library(std::shared_ptr<sol::state> state, const Request &request, const InstanceBundle &bundle); + void add_kick_library(std::shared_ptr<sol::state> state, + const InstanceBundle &bundle); void add_net_library(std::shared_ptr<sol::state> state); void add_db_library(std::shared_ptr<sol::state> state, const Configuration &config); |
