EnragedPvP

Untitled

Feb 3rd, 2021
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. const Discord = require("discord.js");
  2.  
  3. const client = new Discord.Client();
  4.  
  5. const prefix = '-';
  6.  
  7. const fs = require('fs');
  8.  
  9. client.command = new Discord.Collection();
  10.  
  11. const commandfiles = fs.readdirSync('./command/').filter(file => file.endsWith('.js'));
  12. for (const file of commandfiles){
  13. const command = require(`./command/${file}`);
  14.  
  15. client.command.set(command.name, command);
  16. }
  17.  
  18.  
  19. client.on('ready', () => {
  20. console.log('bot is ready');
  21. });
  22.  
  23. client.on('message', message =>{
  24. if(!message.content.startsWith(prefix) || message.author.bot) return;
  25.  
  26. const args = message.content.slice(prefix.length).split(/ +/);
  27. const command = args.shift().toLowerCase();
  28.  
  29. if(command === 'wipe'){
  30. client.commands.get('wipe').execute(message, args);
  31. } else if (command === 'vote') {
  32. client.commands('vote').execute(message, args);
  33. } else if (command === 'command') {
  34. client.commands.get('command').execute(message, args);
  35. } else if (command === 'ping') {
  36. client.commands.get('pong').execute(message, args);
  37. }
  38. {
  39.  
  40. }
  41. });
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment