Skip to content

Instantly share code, notes, and snippets.

@Jackzmc
Created August 15, 2017 02:52
Show Gist options
  • Save Jackzmc/e0cc953d48cb5ce98bae063cd307c77b to your computer and use it in GitHub Desktop.
Save Jackzmc/e0cc953d48cb5ce98bae063cd307c77b to your computer and use it in GitHub Desktop.
if(message.mentions.users.has(client.user.id) || message.mentions.everyone || (message.guild && message.mentions.roles.filter(r=>message.guild.member(client.user.id).roles.has(r.id)).size > 0)) {
const chan = !!message.guild ? `${message.guild.name} #${message.channel.name}` : "";
client.log("mention", chan, message.author, message.cleanContent);
}
if(message.author.id !== client.user.id) return;
if(message.content.indexOf(client.config.prefix) !== 0) return;
const args = message.content.split(/ +/g);
const command = args.shift().slice(client.config.prefix.length).toLowerCase();
const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
if (cmd) {
message.flags = [];
while(args[0] && args[0][0] === "-") {
message.flags.push(args.shift().slice(1));
}
cmd.run(client, message, args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment