Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- //Prefix//
- const prefix = '-';
- const fs = require('fs');
- //Command Handler Worker Code//
- client.commands = new Discord.Collection();
- const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
- for(const file of commandFiles){
- const command = require(`./commands/${file}`);
- client.commands.set(command.name, command);
- }
- //Bot Online Confirmation & Status//
- client.once('ready',() => {
- console.log('Bot Online!');
- client.user.setPresence({
- status: "online",
- activity: {
- type: 'PLAYING',
- name: '"Minecraft"'
- }
- })
- });
- //Splicing For Commands//
- client.on('message', message =>{
- if(!message.content.startsWith(prefix) || message.author.bot) return;
- const args = message.content.slice(prefix.length).split(/ +/);
- const command = args.shift().toLowerCase();
- //Command Handler Responder//
- if(command === 'ping'){
- client.commands.get('ping').execute(message, args);
- } else if (command == 'cmdlist'){
- client.commands.get('cmdlist').execute(message, args);
- } else if (command == 'rules'){
- client.commands.get('rules').execute(message, args, Discord);
- } else if (command == 'purge'){
- client.commands.get('purge').execute(message, args);
- }
- });
- //Client Login Information//
- client.login('Insert Token Here')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement