-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.js
69 lines (55 loc) · 1.94 KB
/
bot.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
62
63
64
65
66
67
68
const { AkairoClient, CommandHandler } = require('discord-akairo');
const { Database } = require('./controller/database');
const { StorageWorker } = require('./controller/storageWorker');
const { MessageGenerator } = require('./controller/messageGenerator');
const { FootballDataOrg } = require('./controller/footballDataOrg');
class Bot {
constructor(){
let bot = this;
try {
bot.settings = require("./data/config.json");
bot.init();
} catch (e) {
console.error(e);
console.error("config.json not found. Please copy data/config.json.example to config.json");
}
}
init(){
let bot = this;
bot.client = new AkairoClient({
}, {
disableEveryone: true
});
bot.client.login(bot.settings.botToken);
this.commandHandler = new CommandHandler(bot.client, {
directory: './commands/',
prefix: this.settings.prefix
});
this.commandHandler.loadAll();
console.log("loadet commands");
bot.client.settings = this.settings;
bot.client.fdo = new FootballDataOrg();
new Database(bot.settings.database).then(function(db){
bot.client.db = db;
require('./models').sequelize.sync().then(function(){
bot.client.storageWorker = new StorageWorker(bot.client.db);
bot.client.messageGenerator = new MessageGenerator(bot);
bot.client.login(bot.settings.botToken).then(() => {
console.log('Started up!');
bot.client.generateInvite().then(link => {
console.info("Prefix: " + bot.settings.prefix,link);
});
});
});
});
}
}
class SportBot extends AkairoClient {
constructor() {
super({
}, {
disableMentions: 'everyone'
});
}
}
new Bot();