Advertisement
Guest User

pasteibjnnasdpoas

a guest
Feb 27th, 2023
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const client = new Discord.Client();
  3.  
  4. //Prefix//
  5.  
  6. const prefix = '-';
  7.  
  8. const fs = require('fs');
  9.  
  10.  //Command Handler Worker Code//
  11.  
  12. client.commands = new Discord.Collection();
  13.  
  14. const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
  15. for(const file of commandFiles){
  16.     const command = require(`./commands/${file}`);
  17.  
  18.     client.commands.set(command.name, command);
  19. }
  20.  
  21. //Bot Online Confirmation & Status//
  22.  
  23. client.once('ready',() => {
  24.     console.log('Bot Online!');
  25.     client.user.setPresence({
  26.         status: "online",
  27.         activity: {
  28.             type: 'PLAYING',
  29.             name: '"Minecraft"'
  30.         }
  31.     })
  32. });
  33.  
  34. //Splicing For Commands//
  35.  
  36. client.on('message', message =>{
  37.  
  38.     if(!message.content.startsWith(prefix) || message.author.bot) return;
  39.  
  40.     const args = message.content.slice(prefix.length).split(/ +/);
  41.     const command = args.shift().toLowerCase();
  42.  
  43. //Command Handler Responder//
  44.  
  45.     if(command === 'ping'){
  46.      client.commands.get('ping').execute(message, args);
  47.     } else if (command == 'cmdlist'){
  48.         client.commands.get('cmdlist').execute(message, args);
  49.     } else if (command == 'rules'){
  50.         client.commands.get('rules').execute(message, args, Discord);
  51.     } else if (command == 'purge'){
  52.         client.commands.get('purge').execute(message, args);
  53.     }  
  54.  
  55. });
  56.  
  57. //Client Login Information//
  58.  
  59. client.login('Insert Token Here')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement