-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
50 lines (38 loc) · 1.32 KB
/
bot.js
File metadata and controls
50 lines (38 loc) · 1.32 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
44
45
46
47
48
49
50
const { Collection } = require('discord.js');
const Akairo = require('discord-akairo');
const MongooseProvider = require('./providers/MongooseProvider');
const model = require('./model');
const { token, ownerID } = require('./auth.json');
class XINE extends Akairo.AkairoClient {
constructor() {
super({
ownerID: ownerID,
});
this.commandHandler = new Akairo.CommandHandler(this, {
directory: './commands/',
prefix: (msg) => {
if (msg.guild) return this.settings.get(msg.guild.id, 'prefix', '%');
return '%';
},
allowMention: true,
});
this.commandHandler.useListenerHandler(this.listenerHandler);
this.listenerHandler = new Akairo.ListenerHandler(this, {
directory: './listeners/',
});
this.listenerHandler.setEmitters({
commandHandler: this.commandHandler,
listenerHandler: this.listenerHandler,
});
this.commandHandler.loadAll();
this.listenerHandler.loadAll();
this.settings = new MongooseProvider(model);
this.players = new Collection();
}
async login(token) {
await this.settings.init();
return super.login(token);
}
}
const client = new XINE();
client.login(token);