-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.js
61 lines (50 loc) · 1.58 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
const fs = require("fs");
const Sentry = require("@sentry/node");
Sentry.init({dsn: process.env.SENTRY_DSN });
const Base = require("eris-sharder").Base;
class silvermemory extends Base {
constructor(bot) {
super(bot);
}
launch() {
let bot = this.bot;
bot.base = this;
bot.sentry = Sentry;
bot.db = require("./modules/db");
bot.msg = require("./modules/msg");
bot.cmd = require("./modules/cmd");
bot.proxy = require("./modules/proxy");
bot.paginator = require("./modules/paginator");
bot.recent = {};
bot.cmds = {};
bot.dialogs = {};
bot.owner = process.env.DISCORD_OWNERID;
bot.defaultCfg = { prefix: process.env.DEFAULT_PREFIX, lang: process.env.DEFAULT_LANG };
try { bot.blacklist = require("./modules/blacklist.json"); }
catch(e) { bot.blacklist = []; }
require("./modules/ipc")(bot);
require("./modules/util")(bot);
let files = fs.readdirSync("./commands");
files.forEach(file => {
bot.cmds[file.slice(0,-3)] = require("./commands/"+file);
});
files = fs.readdirSync("./events");
files.forEach(file => {
bot.on(file.slice(0,-3), (...args) => require("./events/"+file)(...args,bot));
});
process.on("message", message => {
if(bot.ipc[message.name]) bot.ipc[message.name](message);
});
setInterval(() => bot.updateStatus(),3600000); //every hour
bot.updateStatus();
if (!process.env.BOT_INVITE)
delete bot.cmds.invite;
if (!process.env.SUPPORT_INVITE)
delete bot.cmds.feedback;
if(!fs.existsSync("privacy.txt")) {
console.warn("no privacy command");
delete bot.cmds.privacy;
}
}
}
module.exports = silvermemory;