forked from kylosus/Euphemia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
61 lines (54 loc) · 1.62 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
54
55
56
57
58
59
60
61
require('dotenv').config();
const Commando = require('discord.js-commando');
const config = require('./config.json');
const path = require('path');
const sqlite = require('sqlite');
const client = new Commando.Client({
owner: process.env.BOT_OWNER || config.owner,
commandPrefix: process.env.BOT_PREFIX || config.prefix || ';',
disableEveryone: true,
unknownCommandResponse: false,
disabledEvents: [
'GUILD_SYNC',
'GUILD_DELETE',
'CHANNEL_CREATE',
'CHANNEL_DELETE',
'CHANNEL_UPDATE',
'CHANNEL_PINS_UPDATE',
'MESSAGE_DELETE_BULK',
'USER_NOTE_UPDATE',
'USER_SETTINGS_UPDATE',
'PRESENCE_UPDATE',
'VOICE_STATE_UPDATE',
'TYPING_START'
]
});
require('./events/event.js')(client);
global.BOT_DEFAULT_COLOR = config.defaultColor || [233, 91, 169];
client.setProvider(
sqlite.open(path.join(__dirname, 'settings.sqlite3')).then(db => {
return new Commando.SQLiteProvider(db);
})
);
client.registry
.registerDefaultTypes()
.registerGroups([
['anime', 'Anime and Manga commands'],
['bot', 'Public bot commands'],
['fun', 'Fun commands'],
['moderation', 'Moderation commands'],
['owner', 'Owner only commands'],
['setup', 'Server utility setup commands'],
['subscription', 'Tag subscription commands'],
['utility', 'Utility commands']
])
.registerDefaultGroups()
.registerDefaultCommands({
ping: false,
help: false
})
.registerCommandsIn(path.join(__dirname, 'commands'));
client.messageStats = { received: 0, sent: 0, commands: 0 }; // Possible data race, but it's good enough
client.login(process.env.BOT_TOKEN || config.token).catch(error => {
throw `Failed logging in\n${error.message}`;
});