ShardingPlugin
The base class for all plugins
Extends
Constructors
Constructor
new ShardingPlugin(
options
):ShardingPlugin
Parameters
Parameter | Type |
---|---|
options | ShardingPluginOptions |
Returns
ShardingPlugin
Overrides
Properties
Property | Modifier | Type | Default value | Description | Overrides |
---|---|---|---|---|---|
client? | protected | Client | undefined | - | - |
config | readonly | ShardingPluginOptions | undefined | - | - |
gatewayInfo? | protected | APIGatewayBotInfo | undefined | - | - |
id | readonly | "sharding" | "sharding" | An ID that identifies the plugin uniquely between all other used plugins in the Client | Plugin .id |
maxConcurrency | protected | number | undefined | - | - |
shards | readonly | Map <number , GatewayPlugin > | undefined | - | - |
spawning | protected | boolean | false | - | - |
spawnQueue | protected | number [] | [] | - | - |
Methods
calculateShardId()
protected
calculateShardId(guildId
,totalShards
):number
Discord's sharding formula
Parameters
Parameter | Type |
---|---|
guildId | string |
totalShards | number |
Returns
number
disconnect()
disconnect():
void
Returns
void
getShardForGuild()
getShardForGuild(
guildId
):undefined
|GatewayPlugin
Calculate which shard a guild belongs to
Parameters
Parameter | Type |
---|---|
guildId | string |
Returns
undefined
| GatewayPlugin
processSpawnQueue()
protected
processSpawnQueue():Promise
<void
>
Returns
Promise
<void
>
registerClient()
registerClient(
client
):Promise
<void
>
Registers the client with this plugin
Parameters
Parameter | Type | Description |
---|---|---|
client | Client | The client to register |
Returns
Promise
<void
>
Overrides
registerRoutes()?
optional
registerRoutes(client
):void
|Promise
<void
>
Registers the routes of this plugin with the client
Parameters
Parameter | Type | Description |
---|---|---|
client | Client | The client to register the routes with |
Returns
void
| Promise
<void
>