This repository has been archived by the owner on Aug 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
53 lines (37 loc) · 1.44 KB
/
app.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const Discord = require('discord.js');
const fs = require('fs');
const YAML = require('yaml');
const configurationsFile = fs.readFileSync('./settings/configurations.yaml', 'utf8');
const credentialsFile = fs.readFileSync('./settings/credentials.yaml', 'utf8');
const client = new Discord.Client();
client.configurations = YAML.parse(configurationsFile);
client.credentials = YAML.parse(credentialsFile);
client.package = require('./package.json');
client.log = require('./handlers/logHandler');
const Sequelize = require('sequelize');
client.database = new Sequelize(client.credentials.database.URI, {
operatorsAliases: false,
logging: false
});
client.database.authenticate().then(() => {
// Populate Database/Implement model definitions
require('./utils/models')(Sequelize, client.database);
// Load Events
require('./handlers/eventHandler.js')(client);
const Modules = require('./handlers/moduleHandler.js');
client.commands = Modules.commands;
client.aliases = Modules.aliases;
const modules = require('./handlers/moduleHandler.js');
client.commands = modules.commands;
client.aliases = modules.aliases;
client.help = {};
client.login(client.credentials.token).then(() => {
});
}).catch(err => {
client.log.error(err);
});
process.on('unhandledRejection', rejection => {
console.warn('\n[unhandledRejection]');
console.warn(rejection);
console.warn('[/unhandledRejection]\n');
});