mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
10 lines
300 B
TypeScript
10 lines
300 B
TypeScript
/**
|
|
* 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) % shardCount;
|
|
}
|