const manager = new ClusterManager(${__dirname}/bot.js, {
totalShards: 'auto', // or numeric shard count
/// Check below for more options
shardsPerClusters: 2, // 2 shards per process
// totalClusters: 7,
mode: 'process', // you can also choose "worker"
token: 'YOUR_TOKEN',
});
3. Refactor your main bot.js file and provide the sharding parameters to your discord.js client.
```TS
// Typescript: import { ClusterClient, getInfo } from 'discord-hybrid-sharding'
const { ClusterClient, getInfo } = require('discord-hybrid-sharding');
const Discord = require('discord.js');
const client = new Discord.Client({
shards: getInfo().SHARD_LIST, // An array of shards that will get spawned
shardCount: getInfo().TOTAL_SHARDS, // Total number of shards
});
client.cluster = new ClusterClient(client); // initialize the Client, so we access the .broadcastEval()
client.login('YOUR_TOKEN');
Try to get the number of servers that are in total on the clusters: сlient.cluster.fetchClientValues("guilds.cache.size")
What is the expected behavior?
The script outputs an array of the number of servers on each shard
What version of Bun is running?
1.1.8+89d25807f
What platform is your computer?
Microsoft Windows NT 10.0.22621.0 x64
What steps can reproduce the bug?
const manager = new ClusterManager(
${__dirname}/bot.js
, { totalShards: 'auto', // or numeric shard count /// Check below for more options shardsPerClusters: 2, // 2 shards per process // totalClusters: 7, mode: 'process', // you can also choose "worker" token: 'YOUR_TOKEN', });manager.on('clusterCreate', cluster => console.log(
Launched Cluster ${cluster.id}
)); manager.spawn({ timeout: -1 });What is the expected behavior?
The script outputs an array of the number of servers on each shard
What do you see instead?
Emptiness, as if the algorithm is not running
Additional information
No response