From eddea9f1d22f41f62faedecd2f8af5aac64e11b3 Mon Sep 17 00:00:00 2001 From: Zerio <43386412+ZerioDev@users.noreply.github.com> Date: Sun, 15 Nov 2020 18:48:03 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Bug=20fixes=20&=20update=20(v2.0.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- events/message.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/events/message.js b/events/message.js index 4c5340b..e0db2a8 100644 --- a/events/message.js +++ b/events/message.js @@ -1,27 +1,20 @@ -const config = require(`../config/bot.json`) +const config = require("../config/bot.json"); module.exports = (client, message) => { - //Ignore all bots if (message.author.bot) return; - //Prefix let prefix = config.prefix - //Ignore messages not starting with the prefix (in config.json) if (message.content.indexOf(prefix) !== 0) return; - - //Our standard argument/command name definition. + const args = message.content.slice(prefix.length).trim().split(/ +/g); const command = args.shift().toLowerCase(); - - //Grab the command data from the client.commands (Discord collection) + const cmd = client.commands.get(command); - - //If that command doesn't exist, silently exit and do nothing + if (!cmd) return; - - //Run the command + cmd.run(client, message, args); };