forked from dsc-srmrmp/discordbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShard.js
More file actions
31 lines (30 loc) · 841 Bytes
/
Copy pathShard.js
File metadata and controls
31 lines (30 loc) · 841 Bytes
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
/** @format */
const config = require("./src/config");
const { ClusterManager } = require("discord-hybrid-sharding");
[
{
file: "./index.js",
token: config.token,
shards: config.cluster.shardCount,
perCluster: config.cluster.shardsPerCluster,
},
].forEach((client) => {
new ClusterManager(client.file, {
restarts: {
max: config.cluster.restartMax,
interval: config.cluster.restartInterval,
},
respawn: config.cluster.respawn,
mode: config.cluster.mode,
token: client.token,
totalShards: client.shards || "auto",
shardsPerClusters: parseInt(client.perCluster) || 2,
})
.on("shardCreate", (cluster) => {
console.log(`Launched cluster ${cluster.id}`);
})
.on("debug", (info) => {
console.log(`${info}`, "cluster");
})
.spawn({ timeout: -1 });
});