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.
|
|
|
const { Client, Collection, GatewayIntentBits } = require(`discord.js`);
|
|
|
|
const bot = new Client({
|
|
|
|
disableEveryone: true,
|
|
|
|
autoReconnect: true,
|
|
|
|
intents: [
|
|
|
|
GatewayIntentBits.Guilds,
|
|
|
|
GatewayIntentBits.GuildMessages
|
|
|
|
]
|
|
|
|
});
|
|
|
|
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 Collection();
|
|
|
|
bot.aliases = new 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}`)];
|
|
|
|
});
|
|
|
|
})();
|