This repository was archived by the owner on Sep 11, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbot.js
More file actions
66 lines (55 loc) · 2.07 KB
/
bot.js
File metadata and controls
66 lines (55 loc) · 2.07 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const api = require('discord.js');
const config = require('./config/config.json');
const ResourceLoader = require('./const/ResourceLoader');
const messageHandler = require('./const/messageHandler');
const utils = require('./const/utils');
const Client = require('./const/Client');
const ConfirmHelper = require('./const/confirmationHelper');
const Paginate = require('./const/Paginate');
const Events = require('./const/events');
const Context = require('./const/Context');
const Tables = require('./const/createTables');
const stringUtils = require('./const/stringUtils');
process.on('unhandledRejection', (err) => {
if (err.message && ['Missing Access', 'Missing Permissions', 'Unknown Message'].some(x => err.message.includes(x))) return;
console.error(`[ERR] Unhandled rejection:\n${(err && err.stack) || err}`); // eslint-disable-line no-console
});
class MonoxBot {
constructor() {
this.config = config;
this.api = api;
this.utils = utils;
this.ResourceLoader = new ResourceLoader(this);
this.messageHandler = new messageHandler(this);
this.utils = new utils(this);
this.ConfirmationHelper = new ConfirmHelper(this);
this.Paginate = new Paginate(this);
this.db = this.ResourceLoader.createDBInstance();
this.stringUtils = new stringUtils(this);
Tables(this.db);
this.client = new Client({
disableEveryone: true,
fetchAllMembers: true,
messageCacheLifetime: 0,
messageCacheMaxSize: 500,
disableEvents: ['TYPING_START', 'PRESENCE_UPDATE'],
WebsocketOptions: {
compress: true
},
prefix: this.config.prefix,
owner: this.config.admins
}, this);
new Events(this);
this.context = new Context(this);
this.ResourceLoader.loadModules();
this.commands = this.ResourceLoader.loadCommands();
this.ResourceLoader.generateHelpPages();
this.commandCooldowns = new api.Collection();
this.commandEditingStore = new api.Collection();
this.songQueues = new api.Collection();
this.voiceStreams = new api.Collection();
this.playingSongs = new api.Collection();
this.client.login(process.env.TOKEN);
}
}
module.exports = new MonoxBot();