aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/142bot/modules.hpp3
-rw-r--r--modules/mmanager/mmanager.cpp8
-rw-r--r--src/modules.cpp2
3 files changed, 9 insertions, 4 deletions
diff --git a/include/142bot/modules.hpp b/include/142bot/modules.hpp
index 27025b8..3af0253 100644
--- a/include/142bot/modules.hpp
+++ b/include/142bot/modules.hpp
@@ -73,7 +73,8 @@ enum Events
{ \
try \
{ \
- if (!(*_i)->x) { \
+ if (!(*_i)->x) { \
+ list_to_call = loader->EventHandlers[y]; \
break; \
} \
} \
diff --git a/modules/mmanager/mmanager.cpp b/modules/mmanager/mmanager.cpp
index 36b6aae..1a012f9 100644
--- a/modules/mmanager/mmanager.cpp
+++ b/modules/mmanager/mmanager.cpp
@@ -127,7 +127,7 @@ public:
} else {
EmbedSimple("Can't do that, check server logs", message.msg.channel_id);
}
- }else if (lowercase(subcommand) == "ping") {
+ } else if (lowercase(subcommand) == "ping") {
dpp::channel* c = dpp::find_channel(message.msg.channel_id);
if (c) {
std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now();
@@ -139,7 +139,11 @@ public:
this->EmbedSimple(fmt::format("**Pong!** REST Response time: {:.3f} ms", microseconds_ping / 1000, 4), cid);
});
}
- } else {
+ } else if (lowercase(subcommand) == "restart") {
+ EmbedSimple("Restarting...", message.msg.channel_id);
+ ::sleep(5);
+ exit(0);
+ } else {
EmbedSimple("Command not found.", message.msg.channel_id);
}
} else {
diff --git a/src/modules.cpp b/src/modules.cpp
index b2e56e1..0c9fb18 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -57,7 +57,7 @@ ModuleLoader::ModuleLoader(Bot* creator): bot(creator) {
void ModuleLoader::attach(const std::vector<Events> &i, Module* m) {
for (auto n = i.begin(); n != i.end(); ++n) {
if (std::find(EventHandlers[*n].begin(), EventHandlers[*n].end(), m) == EventHandlers[*n].end()) {
- EventHandlers[*n].push_back(m);
+ EventHandlers[*n].insert(EventHandlers[*n].begin(), m);
bot->core->log(dpp::ll_info, fmt::format("Module {} attached to event {}", m->description(), StringNames[*n]));
} else {
bot->core->log(dpp::ll_warning, fmt::format("Module {} already attached to event {}", m->description(), StringNames[*n]));