This commit is contained in:
Jan 2020-12-23 13:48:30 +01:00
parent f50de3e481
commit a96e3cbd96

View file

@ -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')