free-code
Version:
Makes free code for discord.js command/bots
26 lines (23 loc) • 862 B
JavaScript
const client = require('../../src/index')
const prefix = client.prefix;
client.on('message', async message =>{
if(message.author.bot) return;
if(!message.content.startsWith(prefix)) return;
if(!message.guild) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if(cmd.length == 0 ) return;
let command = client.commands.get(cmd)
if(!command) command = client.commands.get(client.aliases.get(cmd));
if(command) {
if(command.ownerOnly) {
if(!message.author.id === '821427615331516416') {
return message.reply('That is an owner only command!!')
} else {
command.run(client, message, args)
}
} else {
command.run(client, message, args)
}
}
});