mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
fix(ShardClientUtil): Fix client event names (#9474)
Co-authored-by: GrapeColor <grapecolor@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -32,26 +32,26 @@ class ShardClientUtil {
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 'process':
|
case 'process':
|
||||||
process.on('message', this._handleMessage.bind(this));
|
process.on('message', this._handleMessage.bind(this));
|
||||||
client.on('ready', () => {
|
client.on(Events.ShardReady, () => {
|
||||||
process.send({ _ready: true });
|
process.send({ _ready: true });
|
||||||
});
|
});
|
||||||
client.on('disconnect', () => {
|
client.on(Events.ShardDisconnect, () => {
|
||||||
process.send({ _disconnect: true });
|
process.send({ _disconnect: true });
|
||||||
});
|
});
|
||||||
client.on('reconnecting', () => {
|
client.on(Events.ShardReconnecting, () => {
|
||||||
process.send({ _reconnecting: true });
|
process.send({ _reconnecting: true });
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'worker':
|
case 'worker':
|
||||||
this.parentPort = require('node:worker_threads').parentPort;
|
this.parentPort = require('node:worker_threads').parentPort;
|
||||||
this.parentPort.on('message', this._handleMessage.bind(this));
|
this.parentPort.on('message', this._handleMessage.bind(this));
|
||||||
client.on('ready', () => {
|
client.on(Events.ShardReady, () => {
|
||||||
this.parentPort.postMessage({ _ready: true });
|
this.parentPort.postMessage({ _ready: true });
|
||||||
});
|
});
|
||||||
client.on('disconnect', () => {
|
client.on(Events.ShardDisconnect, () => {
|
||||||
this.parentPort.postMessage({ _disconnect: true });
|
this.parentPort.postMessage({ _disconnect: true });
|
||||||
});
|
});
|
||||||
client.on('reconnecting', () => {
|
client.on(Events.ShardReconnecting, () => {
|
||||||
this.parentPort.postMessage({ _reconnecting: true });
|
this.parentPort.postMessage({ _reconnecting: true });
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user