Function serenity::utils::shard_id[][src]

pub fn shard_id(guild_id: impl Into<u64>, shard_count: u64) -> u64
Expand description

Calculates the Id of the shard responsible for a guild, given its Id and total number of shards used.

Examples

Retrieve the Id of the shard for a guild with Id 81384788765712384, using 17 shards:

use serenity::utils;

assert_eq!(utils::shard_id(81384788765712384 as u64, 17), 7);