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 --- src/modules.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index 0c9fb18..4b636f9 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -7,6 +7,8 @@ #include #include +#include + const char* StringNames[I_END + 1] = { "I_BEGIN", "I_OnMessage", @@ -45,6 +47,7 @@ const char* StringNames[I_END + 1] = { "I_OnVoiceStateUpdate", "I_OnVoiceServerUpdate", "I_OnWebhooksUpdate", + "I_OnCommand", "I_END" }; @@ -95,7 +98,7 @@ bool ModuleLoader::load(const std::string &fname) { if (Modules.find(fname) == Modules.end()) { char buffer[PATH_MAX + 1]; - getcwd(buffer, PATH_MAX); + realpath(bot->cfg.value("module_path", ".").c_str(), buffer); std::string full_path = std::string(buffer) + "/" + fname; m.dlopen_handle = dlopen(full_path.c_str(), RTLD_NOW | RTLD_LOCAL); @@ -429,6 +432,11 @@ bool Module::OnWebhooksUpdate(const dpp::webhooks_update_t &obj) return true; } +bool Module::OnCommand(const dpp::message_create_t &message, const std::string &command, const std::vector& params) { + bot->core->log(dpp::ll_debug, "Called default OnCommand..."); + return true; +} + bool Module::OnAllShardsReady() { return true; -- cgit v1.2.3