faking_fog

Untitled

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