-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.js
executable file
·43 lines (39 loc) · 1.22 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
const { ShardingManager } = require("discord.js");
const { PhoenixClient } = require("./tools/PhoenixClient");
const fs = require("fs");
const { fork } = require("child_process");
require("./tools/database").connect();
switch (require("./config.json").process.botmode) {
case "prod": {
const client = new PhoenixClient();
client.login(process.env.TOKEN);
break;
}
case "dev": {
const client = new PhoenixClient();
client.login(process.env.STAGINGTOKEN);
break;
}
case "test": {
const client = new PhoenixClient();
client.login(process.env.TESTTOKEN);
break;
}
case "custom": {
const bots = JSON.parse(
fs.readFileSync(__dirname + "/custombots.json", "utf8"),
);
console.log(bots);
console.log(`Phoenix custom bots enabled. Beginning custom bots.`);
console.log(
`Starting the following bots:\n${bots.map((b) => b.client)}\nThis operation will take ${Math.floor((bots.length * 1500) / 1000)} seconds to complete.`,
);
for (let i = 0; i < bots.length; i++) {
const index = i;
setTimeout(function () {
console.log(`Starting bot ${bots[index].client}`);
fork(`custombot.js`).send(bots[index].token);
}, 1500 * i);
}
}
}