Files
discord.js/packages/util/src/functions/calculateShardId.ts
Almeida a9f2bff82a refactor(ShardClientUtil): logic de-duplication (#9491)
added docs to the `calculateShardId` function
2023-05-01 20:08:45 +00:00

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;
}