Helper class for sharded clients spawned as a child process/worker, such as from a ShardingManager. Utilises IPC to send and receive data to/from the master process and other shards.
Message port for the master process (only when mode is
worker
)Fetches a client property value of each shard, or a given shard.
Name | Type | Optional | Description |
---|---|---|---|
prop | string | No | Name of the client property to get, using periods for nesting |
Requests a respawn of all shards.
Returns
Resolves upon the message being sentName | Type | Optional | Description |
---|---|---|---|
options | MultipleShardRespawnOptions | Yes | Options for respawning shards |
Sends a message to the master process.
Name | Type | Optional | Description |
---|---|---|---|
message | unknown | No | Message to send |
Get the shard id for a given guild id.
Name | Type | Optional | Description |
---|---|---|---|
guildId | Snowflake | No | Snowflake guild id to get shard id for |
shardCount | number | No | Number of shards |
Creates/gets the singleton of this class.
Name | Type | Optional | Description |
---|---|---|---|
client | Client<true> | No | The client to use |
mode | ShardingManagerMode | No | Mode the shard was spawned with |