Update message.js

This commit is contained in:
Isaac 2020-09-07 11:10:55 +01:00 committed by GitHub
parent 8a3c8ea4b2
commit f292a3083c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,10 +41,10 @@ Type \`${config.prefix}new\` on the server to create a new ticket.`);
* (no bots / self) * (no bots / self)
*/ */
const regex = new RegExp(`^(<@!?${client.user.id}>|\\${config.prefix})\\s*`); const regex = new RegExp(`^(<@!?${client.user.id}>|\\${config.prefix.toLowerCase()})\\s*`);
if (!regex.test(message.content)) return; // not a command if (!regex.test(message.content.toLowerCase())) return; // not a command
const [, prefix] = message.content.match(regex); const [, prefix] = message.content.toLowerCase().match(regex);
const args = message.content.slice(prefix.length).trim().split(/ +/); const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase(); const commandName = args.shift().toLowerCase();
const command = client.commands.get(commandName) const command = client.commands.get(commandName)
@ -108,4 +108,4 @@ Type \`${config.prefix}new\` on the server to create a new ticket.`);
message.channel.send(`:x: An error occurred whilst executing the \`${command.name}\` command.`); message.channel.send(`:x: An error occurred whilst executing the \`${command.name}\` command.`);
} }
} }
}; };