Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const client = new Discord.Client();
- const prefix = '-';
- const fs = require('fs');
- client.command = new Discord.Collection();
- const commandfiles = fs.readdirSync('./command/').filter(file => file.endsWith('.js'));
- for (const file of commandfiles){
- const command = require(`./command/${file}`);
- client.command.set(command.name, command);
- }
- client.on('ready', () => {
- console.log('bot is ready');
- });
- 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();
- if(command === 'wipe'){
- client.commands.get('wipe').execute(message, args);
- } else if (command === 'vote') {
- client.commands('vote').execute(message, args);
- } else if (command === 'command') {
- client.commands.get('command').execute(message, args);
- } else if (command === 'ping') {
- client.commands.get('pong').execute(message, args);
- }
- {
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment