-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (35 loc) · 1.04 KB
/
index.js
File metadata and controls
43 lines (35 loc) · 1.04 KB
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
const path = require('path');
const sqlite = require('sqlite');
const Commando = require('discord.js-commando');
const config = require(path.join(__dirname, 'config.json'));
const client = new Commando.Client({
owner: config.auth.owner,
commandPrefix: null,
disableEveryone: true,
unknownCommandResponse: false
});
client.registry
.registerGroups([
['misc', 'Miscellaneous']
])
.registerDefaults()
.registerCommandsIn(path.join(__dirname, 'commands'));
client.setProvider(
sqlite.open(path.join(__dirname, 'settings.sqlite3')).then(db => new Commando.SQLiteProvider(db))
).catch(console.error);
client.on('ready', () => {
console.log('Logged in to Discord.');
});
client.login(config.auth.token);
function destructor() {
console.log('Process exiting, destroying client...');
client.destroy();
}
process.on('exit', destructor);
process.on('SIGINT', destructor);
process.on('SIGUSR1', destructor);
process.on('SIGUSR2', destructor);
process.on('unhandledRejection', error => {
console.log(error);
process.exit(2);
});