-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
38 lines (31 loc) · 1.25 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
32
33
34
35
36
37
38
const { CommandoClient, SQLiteProvider } = require('discord.js-commando');
const path = require('path');
const config = require('./configs/app.json');
const YoutubePlayer = require('./services/player/youtube-player');
const sqlite = require('sqlite');
const TimeArgumentType = require('./arguments/time-argument');
const Youtube = require('@mindaugaskasp/node-youtube');
const EventLoaderService = require('./services/event-loader-service');
sqlite.open(path.join(`${__dirname}/sqlite`, "database.sqlite3")).then((db) => {
client.setProvider(new SQLiteProvider(db));
});
const client = new CommandoClient({
commandPrefix: config.bot.default_cmd_prefix,
unknownCommandResponse: false,
owner: config.bot.owners,
disableEveryone: true
});
client.config = config;
client.music = new YoutubePlayer(new Youtube(config.youtube.token, config.youtube.base_url));
new EventLoaderService(client).load();
client.registry
.registerDefaultTypes()
.registerGroups([
['music', 'Music playback commands']
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerTypes([TimeArgumentType])
.registerCommandsIn(path.join(__dirname, 'commands'));
process.on('unhandledRejection', console.error);
client.login(config.bot.token);