You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
690 B
JavaScript

const Discord = require(`discord.js`);
const bot = new Discord.Client({
disableEveryone: true,
autoReconnect: true
});
const {
promisify
} = require(`util`);
const readdir = promisify(require(`fs`).readdir);
require(`dotenv`).config();
bot.login(process.env.TOKEN);
bot.config = require(`./config.json`);
bot.commands = new Discord.Collection();
bot.aliases = new Discord.Collection();
(async function() {
const eventFiles = await readdir(`./Events/`);
eventFiles.forEach(file => {
const eventName = file.split(`.`)[0];
const event = require(`./Events/${file}`);
bot.on(eventName, event.bind(null, bot));
delete require.cache[require.resolve(`./Events/${file}`)];
});
})();