Last active
August 25, 2020 13:00
-
-
Save VLTNOgithub/7a9b6bced8bfedbfd133b7065e312572 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Discord = require('discord.js'); | |
const bot = new Discord.Client(); | |
const fs = require('fs'); | |
const prefix = '-'; | |
const token = 'TOKEN'; | |
bot.commands = new Discord.Collection(); | |
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); | |
for(const file of commandFiles){ | |
const command = require(`./commands/${file}`); | |
bot.commands.set(command.name, command); | |
} | |
bot.on('ready', () => { | |
console.log('ValBot is online!'); | |
}); | |
bot.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 === 'commands'){ | |
bot.commands.get('commands').execute(message, args); | |
} else if (command === 'site'){ | |
bot.commands.get('site').execute(message, args); | |
} else if (command === 'yt'){ | |
bot.commands.get('yt').execute(message, args); | |
} else if (command === 'ping'){ | |
bot.commands.get('ping').execute(message, args); | |
} | |
}) | |
bot.login(token); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment