Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- client.commands = new Discord.Collection();
- const fs = require('fs');
- const vm = require('vm.js')
- client.on('ready' , () => {
- console.log('Le bot est bien connecté')
- })
- fs.readdir('./commands/', (error, f) => {
- if (error) { return console.error(error); }
- let commandes = f.filter(f => f.split('.').pop() === 'js');
- if (commandes.length <= 0) { return console.log('Aucune commande trouvée !'); }
- commandes.forEach((f) => {
- let commande = require(`./commands/${f}`);
- console.log(`${f} commande chargée !`);
- client.commands.set(commande.help.name, commande);
- });
- });
- fs.readdir('./events/', (error, f) => {
- if (error) { return console.error(error); }
- console.log(`${f.length} events chargés`);
- f.forEach((f) => {
- let events = require(`./events/${f}`);
- let event = f.split('.')[0];
- client.on(event, events.bind(null, client));
- });
- });
- client.login(process.env.TOKEN);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement