Carbon
Plugins/Sharding/Classes

ShardingPlugin

The base class for all plugins

Extends

Constructors

Constructor

new ShardingPlugin(options): ShardingPlugin

Parameters

ParameterType
optionsShardingPluginOptions

Returns

ShardingPlugin

Overrides

Plugin.constructor

Properties

PropertyModifierTypeDefault valueDescriptionOverrides
client?protectedClientundefined--
configreadonlyShardingPluginOptionsundefined--
gatewayInfo?protectedAPIGatewayBotInfoundefined--
idreadonly"sharding""sharding"An ID that identifies the plugin uniquely between all other used plugins in the ClientPlugin.id
maxConcurrencyprotectednumberundefined--
shardsreadonlyMap<number, GatewayPlugin>undefined--
spawningprotectedbooleanfalse--
spawnQueueprotectednumber[][]--

Methods

calculateShardId()

protected calculateShardId(guildId, totalShards): number

Discord's sharding formula

Parameters

ParameterType
guildIdstring
totalShardsnumber

Returns

number


disconnect()

disconnect(): void

Returns

void


getShardForGuild()

getShardForGuild(guildId): undefined | GatewayPlugin

Calculate which shard a guild belongs to

Parameters

ParameterType
guildIdstring

Returns

undefined | GatewayPlugin


processSpawnQueue()

protected processSpawnQueue(): Promise<void>

Returns

Promise<void>


registerClient()

registerClient(client): Promise<void>

Registers the client with this plugin

Parameters

ParameterTypeDescription
clientClientThe client to register

Returns

Promise<void>

Overrides

Plugin.registerClient


registerRoutes()?

optional registerRoutes(client): void | Promise<void>

Registers the routes of this plugin with the client

Parameters

ParameterTypeDescription
clientClientThe client to register the routes with

Returns

void | Promise<void>

Inherited from

Plugin.registerRoutes

On this page