-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
32 lines (26 loc) · 989 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const chalk = require('chalk');
const yaml = require('js-yaml');
const fs = require('fs');
const LoadCommands = require('./handlers/LoadCommands');
const LoadEvents = require('./handlers/LoadEvents');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.MessageContent,
]
});
client.config = yaml.load(fs.readFileSync('./config.yml', 'utf8'));
client.slashCommands = new Collection();
client.contextMenus = new Collection();
LoadCommands(client)
LoadEvents(client)
process.on('uncaughtException', function (error) {
console.log(chalk.yellow(`[${client.config.prefix}] `) + chalk.red('[ANTI CRASH] ') + chalk.green('Found an error!'))
console.error(error.stack)
})
client.login(client.config.token);