Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs');
- const { Client, Collection, Intents } = require('discord.js');
- const { token } = require('./config.json');
- const bot = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
- const events = fs.readFileSync("./events").filter(file => file.endsWith(".js"));
- for( const file of events) {
- const eventName = file.split(".")[0];
- const event = require(`./events/${file}`)
- bot.on(eventName, event.bind(null, bot));
- }
- const commands = fs.readFileSync("./commands").filter(file => file.endsWith(".js"));
- for( const file of commands) {
- const commandName = file.split(".")[0];
- const command = require(`./commands/${file}`);
- console.log(`Loading ${commandName}`);
- bot.commands.set(command.name, command);
- }
- bot.login(token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement