Optimize checks in messageCreate event

This commit is contained in:
TheEssem 2020-03-14 18:22:09 -05:00
parent 93a7b3fa0d
commit 446ba109c7
2 changed files with 2 additions and 5 deletions

View file

@ -18,7 +18,7 @@ module.exports = async (message) => {
const prefix = prefixMention.test(message.content) ? message.content.match(prefixMention)[0] : (await database.guilds.find({ id: message.channel.guild.id }).exec())[0].prefix;
// ignore other stuff
if (message.content.startsWith(prefix) === false && !message.mentions.includes(client.user)) return;
if (message.content.startsWith(prefix) === false) return;
// && message.channel.id !== "573553254575898626"
// funny stuff
@ -37,8 +37,7 @@ module.exports = async (message) => {
}*/
// separate commands and args
const escapedPrefix = misc.regexEscape(prefix);
const prefixRegex = new RegExp(`^(${escapedPrefix})`);
const prefixRegex = new RegExp(`^(${misc.regexEscape(prefix)})`);
const content = message.content.replace(prefixRegex, "").trim();
const args = content.split(/ +/g);
const command = args.shift().toLowerCase();

View file

@ -1,5 +1,3 @@
//const { Collection } = require("eris");
exports.commands = new Map();
exports.aliases = new Map();
exports.info = new Map();