Skip to main content
Latest
interface ActivateResharderOptions
import { type ActivateResharderOptions } from "https://deno.land/x/discordeno@18.0.1/gateway/manager/resharder.ts";

Properties

optional
checkInterval: number

Interval in milliseconds of when to check whether it's time to reshard.

gatewayManager: GatewayManager

Gateway manager which the resharder should be bound to.

optional
percentage: number

Percentage at which resharding should occur.

optional
useOptimalLargeBotSharding: boolean

Whether the resharder should automatically switch to LARGE BOT SHARDING when the bot is above 100K servers.

Methods

getGatewayBot(): Promise<GetGatewayBot>

Function which can be used to fetch the current gateway information of the bot. This function is mainly used by the reshard checker.

tellWorkerToPrepare(
gatewayManager: GatewayManager,
workerId: number,
shardId: number,
bucketId: number,
): Promise<void>

Function which is used to tell a Worker that it should identify a resharder Shard to the gateway and wait for further instructions. The worker should NOT process any events coming from this Shard.

shardIsPending(resharder: Resharder, shard: Shard): Promise<void>

Tell the resharder and manager that the a shard is created and identified using new settings but is currently pending by ignoring incoming events. This can be used to track all shards are online which is when old shards are closed and these new shards replace the old ones.

markNewGuildShardId(guildIds: string[], shardId: number): Promise<void>

Used to update the shard ids of the cached guilds. When a bot is resharded, guilds can be moved around across shards to evenly distribute, so the shards need to be updated.