From 8edf3bf0ca81b942a165cde3bdea11ca755da955 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Mon, 10 Apr 2023 11:15:35 -0400 Subject: modldr: Support modules in a different path from exe Change-Id: If56998535b8067b29ea34c760ac2da4339174983 --- include/142bot/bot.hpp | 4 +++- include/142bot/modules.hpp | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/142bot/bot.hpp b/include/142bot/bot.hpp index 98a7ed6..342f32e 100644 --- a/include/142bot/bot.hpp +++ b/include/142bot/bot.hpp @@ -2,6 +2,7 @@ #include #include #include +#include #ifndef BOT_HPP @@ -17,10 +18,11 @@ public: char prefix; pqxx::connection conn; class dpp::cluster * core; + json cfg; /* The bot's user from the ready event */ dpp::user user; - Bot(bool development, dpp::cluster* cluster, char prefix); + Bot(bool development, dpp::cluster* cluster, char prefix, json &cfg); //virtual ~Bot(); void set_owner_id(dpp::snowflake id); diff --git a/include/142bot/modules.hpp b/include/142bot/modules.hpp index c0aad32..0d48a56 100644 --- a/include/142bot/modules.hpp +++ b/include/142bot/modules.hpp @@ -54,6 +54,7 @@ enum Events I_OnVoiceStateUpdate, I_OnVoiceServerUpdate, I_OnWebhooksUpdate, + I_OnCommand, I_END }; @@ -72,13 +73,16 @@ enum Events } \ for (auto _i = list_to_call.begin(); _i != list_to_call.end(); ++_i) \ { \ + core->log(dpp::ll_debug, fmt::format("Attempting to call module")); \ try \ { \ if (!(*_i)->x) { \ list_to_call = loader->EventHandlers[y]; \ + core->log(dpp::ll_error, "Something happened!"); \ break; \ } \ sentry_remove_tag("module"); \ + core->log(dpp::ll_debug, "called module 1"); \ } \ catch (std::exception& modexcept) \ { \ @@ -89,6 +93,7 @@ enum Events sentry_event_add_exception(event, exc); \ sentry_capture_event(event); \ } \ + core->log(dpp::ll_debug, "Called module"); \ } \ }; @@ -196,6 +201,7 @@ public: virtual bool OnVoiceStateUpdate(const dpp::voice_state_update_t &obj); virtual bool OnVoiceServerUpdate(const dpp::voice_server_update_t &obj); virtual bool OnWebhooksUpdate(const dpp::webhooks_update_t &obj); + virtual bool OnCommand(const dpp::message_create_t &message, const std::string &command, const std::vector& params); void EmbedSimple(const std::string &message, int64_t channelID); }; -- cgit v1.2.3