From a96e3cbd962c5f49897e8becbccf7bab39ec3ce2 Mon Sep 17 00:00:00 2001 From: Jan <26145882+imverum@users.noreply.github.com> Date: Wed, 23 Dec 2020 13:48:30 +0100 Subject: [PATCH] add code --- util/eventHandler.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/eventHandler.js b/util/eventHandler.js index 5d03022..862e4dc 100644 --- a/util/eventHandler.js +++ b/util/eventHandler.js @@ -26,12 +26,15 @@ client.on('message', message => { msgContent = msgContent.split(usedPrefix)[1]; if (msgContent.startsWith(' ') && usedPrefix != prefix) msgContent = msgContent.substr(1, msgContent.length); const args = msgContent.split(' '); - const cmdName = args.shift(); + const cmdName = args.shift()?.toLowerCase(); const cmd = commands.find(cmd => cmd.meta?.name == cmdName || cmd.meta?.aliases?.indexOf(cmdName) > -1); if (!cmd) return require('./69Reply').execute(message); + logger.info(`[CMD] ${message.author.id} ${message.author.tag} => ${cmdName}, ${args.join(' ')}`); + if (cmd.meta?.staffOnly && !message.member.permissions.has('ADMINISTRATOR')) { + logger.warn(`${message.author.tag} => Refusing to run staff command`); message.channel.send( new Discord.MessageEmbed() .setTitle('You are unworthy')