guildIdToShardId()
function src/tools.ts:8function guildIdToShardId(guildId: string, shardCount?: number): numberParameters
guildId
string
shardCount?
number
Small helpers, like working out which shard a guild is on.
import { Tools } from 'detritus-utils';Standalone helpers.
function guildIdToShardId(guildId: string, shardCount?: number): numberfunction normalize(object: { [key: string]: any }): Readonly<{ [key: string]: any }>function URIEncodeWrap<T extends URIEncodeWrapSafe<T>>(unsafe: T): Readonly<T>Named types used across the API.
type URIEncodedArgument<T> = string | Extract<T, "" | 0 | 0n | false | null | undefined>What a wrapped function actually gets for an argument: truthy ones are stringified and encoded, falsy ones pass through
type URIEncodeWrapFunc = (...args: any[]) => stringtype URIEncodeWrapped = { [key: string]: any }type URIEncodeWrapSafe<T> = { [K in keyof T]: T[K] extends (...args: infer A) => any ? (...args: { [I in keyof A]: URIEncodedArgument<…[…]> }) => any : T[K] }Parameters must accept strings, so a number or bigint one is a type error instead of id + 1n silently concatenating