Advertisement
ninja-gen

message.js

Nov 17th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2.  
  3. module.exports = (client, message) => {
  4.  
  5. const ninjaPrefix = (`<@636257382829129739>`);
  6. const prefix = process.env.PREFIX;
  7.  
  8.     if (message.author.bot) return;
  9.    
  10.     if (message.content.indexOf(prefix) !== 0) return;
  11.    
  12.     client.message = message;
  13.  
  14. let cmdEmbed = new Discord.RichEmbed()
  15.     .setTitle(":no_entry: Command Error :no_entry:")
  16.     .setColor("0xff0000")
  17.     .setTimestamp()
  18.     .setDescription(`<@${message.author.id}> Sorry that command doesn't exist :shrug:`)
  19.  
  20.    const args = message.content.slice(prefix.length).trim().split(/ +/g);
  21.    //console.log(args);
  22.    const command = args.shift().toLowerCase();
  23.    //console.log(command);
  24.    const cmd = client.commands.get(command);
  25.    //console.log(cmd);
  26.    if (!cmd) return message.channel.send(cmdEmbed);
  27.  
  28.    //console.log(cmd);
  29.    cmd.run(client, message, args);
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement