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.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);
- }
- client.once('ready', () => {
- console.log('_____ is online!');
- });
- 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 === 'ping'){
- client.commands.get('ping').execute(message, args);
- } else if (command == 'ping'){
- client.commands.get('ping').execute(message, args);
- }
- });
- client.login('discord bot token here');
Add Comment
Please, Sign In to add comment