-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
31 lines (26 loc) · 1.07 KB
/
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
// Modules
const Bot = require('./Bot');
require('dotenv').config({ path: './.env'});
const chalk = require('chalk');
const { stripIndents } = require('common-tags');
// Client
const bot = new Bot();
// Debugging
//bot.on('raw', console.log);
//bot.on('debug', m => console.log(`${chalk.cyan('[Debug]')} - ${m}`));
bot.on('rateLimit', rl => console.warn(
stripIndents`${chalk.yellow('[Ratelimit]')}
Timeout: ${rl.timeout}
Limit: ${rl.limit}
Route: ${rl.route}`));
bot.on('warn', w => console.warn(`${chalk.yellow('[Warn]')} - ${w}`));
bot.on('error', e => console.error(`${chalk.redBright('[Error]')} - ${e.stack}`));
process.on('uncaughtException', e => console.error(`${chalk.redBright('[Error]')} - ${e.stack}`));
process.on('unhandledRejection', e => console.error(`${chalk.redBright('[Error]')} - ${e.stack}`));
process.on('warning', e => console.warn(`${chalk.yellow('[Error]')} - ${e.stack}`));
// Handlers' modules
['command', 'event'].forEach(handler => {
require(`./src/handlers/${handler}`)(bot);
});
// Login and turn on (default is DISCORD_TOKEN)
bot.login();