export class Shard extends EventEmitter
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.
string[] args :
Arguments for the shard's process/worker
unknown env :
Environment variables for the shard's process, or workerData for the shard's worker
string[] execArgv :
Arguments for the shard's process/worker executable
number id :
The shard's id in the manager
ShardingManager manager :
Manager that created the shard
ChildProcess | null process :
Process of the shard (if mode is process
)
Fetches a client property value of the shard.
shard.fetchClientValue('guilds.cache.size')
.then(count => console.log(`${count} guilds in shard ${shard.id}`))
.catch(console.error);
killvoid () :
Immediately kills the shard's process/worker and does not restart it.
onEvent extends keyof ShardEventTypes
>(event: Eventlistener: (...args: ShardEventTypes[Event]) => void) : this <
Event extends keyof ShardEventTypes
onceEvent extends keyof ShardEventTypes
>(event: Eventlistener: (...args: ShardEventTypes[Event]) => void) : this <
Event extends keyof ShardEventTypes
respawn) : Promise<ChildProcess> (
Kills and restarts the shard's process/worker.
spawntimeout?: number) : Promise<ChildProcess> (
Forks a child process or creates a worker thread for the shard. You should not need to call this manually.
deathprocess: ChildProcess | Worker) (
Emitted upon the shard's child process/worker exiting.
Emitted upon the shard's shardDisconnect event.
messagemessage: any) (
Emitted upon receiving a message from the child process/worker.
Emitted upon the shard's shardReconnecting event.
Emitted upon the shard's shardResume event.
spawnprocess: ChildProcess | Worker) (
Emitted upon the creation of the shard's child process/worker.