mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
refactor(ShardClientUtil): logic de-duplication (#9491)
added docs to the `calculateShardId` function
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* Calculates the shard id for a given guild id.
|
||||
*
|
||||
* @param guildId - The guild id to calculate the shard id for
|
||||
* @param shardCount - The total number of shards
|
||||
*/
|
||||
export function calculateShardId(guildId: string, shardCount: number) {
|
||||
return Number((BigInt(guildId) >> 22n) % BigInt(shardCount));
|
||||
return Number(BigInt(guildId) >> 22n) % shardCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user