Skip to main content
Module

x/discordeno/mod.ts>CreateGatewayManager

Discord API library for Deno
Go to Latest
interface CreateGatewayManager
import { type CreateGatewayManager } from "https://deno.land/x/discordeno@13.0.0-rc45/mod.ts";

Properties

spawnShardDelay: number

Delay in milliseconds to wait before spawning next shard. OPTIMAL IS ABOVE 5100. YOU DON'T WANT TO HIT THE RATE LIMIT!!!

totalShards: number

Total amount of shards your bot uses. Useful for zero-downtime updates or resharding.

shardsPerWorker: number

The amount of shards to load per worker.

totalWorkers: number

The total amount of workers to use for your bot.

firstShardId: number

Id of the first Shard which should get controlled by this manager.

NOTE: This is intended for testing purposes if big bots want to test the gateway on smaller scale. This is not recommended to be used in production.

lastShardId: number

Id of the last Shard which should get controlled by this manager.

NOTE: This is intended for testing purposes if big bots want to test the gateway on smaller scale. This is not recommended to be used in production.

gatewayBot: GetGatewayBot

Important data which is used by the manager to connect shards to the gateway.

gatewayConfig: PickPartial<ShardGatewayConfig, "token">
optional
createShardOptions: Omit<CreateShard,
| "id"
| "totalShards"
| "requestIdentify"
| "gatewayConfig"
>

Options which are used to create a new shard.

buckets: Collection<number, { workers: { id: number; queue: number[]; }[]; leak: LeakyBucket; }>

Stored as bucketId: { workers: [workerId, [ShardIds]], createNextShard: boolean }

prepareBuckets: prepareBuckets

Prepares the buckets for identifying

spawnShards: spawnShards

The handler for spawning ALL the shards.

stop: stop

The handler to close all shards.

handleDiscordPayload: (shard: Shard, data: DiscordGatewayPayload) => any

Sends the discord payload to another server.

tellWorkerToIdentify: tellWorkerToIdentify

Tell the worker to begin identifying this shard

debug: (text: GatewayDebugEvents, ...args: any[]) => unknown

Handle the different logs. Used for debugging.

calculateTotalShards: calculateTotalShards

Calculates the number of shards to use based on the max concurrency

calculateWorkerId: calculateWorkerId

Calculate the id of the worker related ot this Shard.