A self-contained shard created by the ShardingManager. Each one has a that contains an instance of the bot and its Client. When its child process/worker exits for any reason, the shard will spawn a new one to replace it as necessary.
Extends
EventEmitterEmitted upon the shard's child process/worker exiting.
| Name | Type | Optional | Description |
|---|---|---|---|
| process | ChildProcessWorker | No | Child process/worker that exited |
Emitted upon the shard's shardDisconnect event.
Emitted upon receiving a message from the child process/worker.
| Name | Type | Optional | Description |
|---|---|---|---|
| message | * | No | Message that was received |
Emitted upon the shard's shardReconnecting event.
Emitted upon the shard's shardResume event.
Whether the shard's Client is ready
Evaluates a script or function on the shard, in the context of the Client.
Returns
Result of the script execution| Name | Type | Optional | Description |
|---|---|---|---|
| script | string | No | JavaScript to run on the shard |
Fetches a client property value of the shard.
| Name | Type | Optional | Description |
|---|---|---|---|
| prop | string | No | Name of the client property to get, using periods for nesting |
Immediately kills the shard's process/worker and does not restart it.
| Name | Type | Optional | Description |
|---|---|---|---|
| event | K | No | None |
| listener | (...args: ShardEventTypes[K]) => Awaitable<void> | No | None |
| Name | Type | Optional | Description |
|---|---|---|---|
| event | K | No | None |
| listener | (...args: ShardEventTypes[K]) => Awaitable<void> | No | None |
Kills and restarts the shard's process/worker.
| Name | Type | Optional | Description |
|---|---|---|---|
| options | { delay?: number; timeout?: number } | Yes | Options for respawning the shard |
Sends a message to the shard's process/worker.
| Name | Type | Optional | Description |
|---|---|---|---|
| message | unknown | No | Message to send to the shard |
Forks a child process or creates a worker thread for the shard. You should not need to call this manually.
| Name | Type | Optional | Description |
|---|---|---|---|
| timeout | number | Yes | The amount in milliseconds to wait until the Client has become ready before resolving (-1 or Infinity for no wait) |