Sir_Spaceboi

Untitled

Dec 31st, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bot.on("message", message => {
  2.   const botID = bot.user.id
  3.  
  4.   if (message.content.includes(botID)) {
  5.     message.channel.send('My prefix for this server is `+`!')
  6.   }
  7.  
  8.   if (!message.content.startsWith(prefix) || message.author.bot) return;
  9.  
  10.   const args = message.content.slice(prefix.length).split(/ +/);
  11.   const commandName = args.shift().toLowerCase();
  12.  
  13.   const command = bot.commands.get(commandName) || bot.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
  14.  
  15.   if (!command) return;
  16.  
  17.   try {
  18.     command.execute(message, args, bot, config);
  19.   } catch (error) {
  20.     console.error(error)
  21.     message.reply('an issue occurred, please contact support if this persists.')
  22.   }
  23. })
Advertisement
Add Comment
Please, Sign In to add comment