-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.js
29 lines (26 loc) · 885 Bytes
/
main.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
require("./other/patchConsoleLog");
const Cluster = require('discord-hybrid-sharding');
const config = require("./config");
const { plsParseArgs } = require('plsargs');
const argv = plsParseArgs(process.argv.slice(2));
let customToken = argv.get("clientToken");
if (customToken) config.clientToken = customToken;
if (argv.has("shardingOn")) config.sharding?.enabled = true;
if (argv.has("shardingOff")) config.sharding?.enabled = false;
if (config.sharding.enabled) {
const manager = new Cluster.Manager(`${__dirname}/index.js`, {
totalShards: config.sharding.count[0],
shardsPerClusters: config.sharding.count[1],
mode: 'process',
token: config.clientToken,
respawn: true,
execArgv: ["--expose-gc"],
keepAlive: {
interval: 5000,
maxMissedHeartbeats: 12
}
});
config.sharding.onManager(manager);
} else {
require("./index.js");
}