aboutsummaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2023-04-10 11:15:35 -0400
committerCara Salter <cara@devcara.com>2023-04-10 11:15:35 -0400
commit8edf3bf0ca81b942a165cde3bdea11ca755da955 (patch)
treed644a49a7f5784426b07960b9e4a8a31804eb50a /src/modules.cpp
parentacc7f305eedbfc6e05000c6bc72cd35bd1443452 (diff)
download142bot-8edf3bf0ca81b942a165cde3bdea11ca755da955.tar.gz
142bot-8edf3bf0ca81b942a165cde3bdea11ca755da955.zip
modldr: Support modules in a different path from exe
Change-Id: If56998535b8067b29ea34c760ac2da4339174983
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp10
1 files changed, 9 insertions, 1 deletions
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 <limits.h>
#include <link.h>
+#include <stdlib.h>
+
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<std::string>& params) {
+ bot->core->log(dpp::ll_debug, "Called default OnCommand...");
+ return true;
+}
+
bool Module::OnAllShardsReady()
{
return true;