|
@@ -11,6 +11,7 @@ import { logger } from "./logging";
|
|
|
import { PluginManager } from "./plugin_manager";
|
|
|
|
|
|
export const plgMgr: PluginManager = new PluginManager(path.resolve(path.dirname(module.filename), "plugins"));
|
|
|
+const COMMAND_PREFIX = "/";
|
|
|
|
|
|
client.bot.on("ready", async () => {
|
|
|
logger.info("Starting up NoctBot");
|
|
@@ -29,6 +30,10 @@ client.bot.on("message", async m => {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (m.content.startsWith(COMMAND_PREFIX) && await plgMgr.runCommand("prefix", m, m.content)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
let content = m.cleanContent.trim();
|
|
|
|
|
|
if (await plgMgr.trigger("message", m, content))
|
|
@@ -40,7 +45,7 @@ client.bot.on("message", async m => {
|
|
|
content = content.substring(`@${client.botUser.username}`.length).trim();
|
|
|
const lowerCaseContent = content.toLowerCase();
|
|
|
|
|
|
- if (await plgMgr.runCommand(m, content))
|
|
|
+ if (await plgMgr.runCommand("mention", m, content))
|
|
|
return;
|
|
|
|
|
|
if (await plgMgr.trigger("directMention", m, lowerCaseContent))
|