-
Notifications
You must be signed in to change notification settings - Fork 1
/
Mage.js
50 lines (38 loc) · 1.15 KB
/
Mage.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
const Eris = require("eris");
const FS = require("fs");
global.Promise = require("bluebird");
global.Magic = require("./Magic.js");
global.Vars = require("./util/vars.js");
global.bot = new Eris.Client(Magic.config.TOKEN, {});
bot.on("ready", () => {
bot.editStatus("online", {name: "Explosion!"})
console.log("Ready!");
});
process.stdin.resume();
process.on("SIGINT", () => {
bot.disconnect({reconnect:false});
process.exit(0);
});
process.on("unhandledRejection", err => {
if(!err) return;
Magic.logToDev("Unhandled Rejection", err);
});
process.on("uncaughtException", err => {
if(!err) return;
Magic.logToDev("Uncaught Exception", err);
});
bot.on("error", (err, id) => {
if(!err) return;
Magic.logToDev("Shard error(" + id + ")", err);
});
bot.connect();
exports.addCommand = (command) => {
if(!exports.commands[command.type]) exports.commands[command.type] = {};
exports.commands[command.type][command.name] = command;
};
exports.bot = bot;
exports.commands = {};
exports.managers = {};
exports.Command = require("./util/command.js");
exports.cmdScripts = Magic.loadScripts("./commands/");
exports.utilScripts = Magic.loadScripts("./util/");