-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshards.js
More file actions
22 lines (19 loc) · 762 Bytes
/
shards.js
File metadata and controls
22 lines (19 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { ShardingManager } = require('discord.js'); //imports the sharding manager
require("dotenv").config();
const manager = new ShardingManager('./index.js', {
token: process.env.TOKEN || "", //paste your token here
respawn: true,
autoSpawn: true,
totalShards: 1, //amount of shards
shardList: "auto", //edit it only if you know what are you doing
});
manager.spawn({ amount: manager.totalShards, delay: null, timeout: -1 }).then((shards) => {
console.log(`[CLIENT] ${shards.size} shard(s) spawned.`);
}).catch((err) => {
console.log("[CLIENT] An error has occurred :", err);
});
manager.on("shardCreate", (shard) => {
shard.on("ready", () => {
console.log(`[CLIENT] Shard ${shard.id} connected`);
});
});