A self-contained shard created by the ShardingManager. Each one has a ChildProcess 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 | ChildProcess | Worker | No | Child process/worker that exited |
Emitted upon receiving a message from the child process/worker.
Name | Type | Optional | Description |
---|---|---|---|
message | any | No | Message that was received |
Emitted upon the creation of the shard's child process/worker.
Name | Type | Optional | Description |
---|---|---|---|
process | ChildProcess | Worker | No | Child process/worker that was created |
Process of the shard (if mode is
process
)Fetches a client property value of the shard.
Example
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 | Constraints | Optional | Default | Description |
---|---|---|---|---|
Event | keyof ShardEventTypes | No | None |
Name | Type | Optional | Description |
---|---|---|---|
event | Event | No | None |
listener | (...args: ShardEventTypes[Event]) => void | No | None |
Name | Constraints | Optional | Default | Description |
---|---|---|---|---|
Event | keyof ShardEventTypes | No | None |
Name | Type | Optional | Description |
---|---|---|---|
event | Event | No | None |
listener | (...args: ShardEventTypes[Event]) => void | No | None |
Kills and restarts the shard's process/worker.
Sends a message to the shard's process/worker.
Name | Type | Optional | Description |
---|---|---|---|
message | unknown | No | Message to send to the shard |