-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.js
32 lines (24 loc) · 959 Bytes
/
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
global.discord = require("discord.js");
global.glob = require("glob");
global.path = require("path");
global.shlex = require('./framework/custom_edits/shlex');
global.Command = require('./framework/core/Command');
global.Listener = require('./framework/core/Listener');
const base_classes = glob.sync('./base_classes/**/*.js').map(file => {
const resolved_path = path.resolve(file);
delete require.cache[resolved_path];
return require(resolved_path)
});
for (const c of base_classes) {
global[c.name] = c;
}
const DiscordBot = require("./framework/DiscordBot");
// if using glitch comment out the line below
require('dotenv').config();
if (!process.env.DISCORD_TOKEN)
return console.error('Missing bot token in .env');
if (!process.env.DISCORD_PREFIX) {
console.error('Missing bot prefix, using / as default')
process.env.DISCORD_PREFIX = '/';
}
new DiscordBot(process.env.DISCORD_PREFIX, process.env.DISCORD_TOKEN).run();