From 9abfdc50267e83b3fc3a91771ebb484720f41597 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sat, 25 Feb 2023 17:28:42 +0700 Subject: [PATCH] fix: Shard did not receive any more guild packets --- src/client/websocket/WebSocketShard.js | 27 ++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/client/websocket/WebSocketShard.js b/src/client/websocket/WebSocketShard.js index ae5f002..e372747 100644 --- a/src/client/websocket/WebSocketShard.js +++ b/src/client/websocket/WebSocketShard.js @@ -538,21 +538,24 @@ class WebSocketShard extends EventEmitter { const { waitGuildTimeout } = this.manager.client.options; - this.readyTimeout = setTimeout(() => { - this.debug( - `Shard ${hasGuildsIntent ? 'did' : 'will'} not receive any more guild packets` + - `${hasGuildsIntent ? ` in ${waitGuildTimeout} ms` : ''}.\nUnavailable guild count: ${ - this.expectedGuilds.size - }`, - ); + this.readyTimeout = setTimeout( + () => { + this.debug( + `Shard ${hasGuildsIntent ? 'did' : 'will'} not receive any more guild packets` + + `${hasGuildsIntent ? ` in ${waitGuildTimeout} ms` : ''}.\nUnavailable guild count: ${ + this.expectedGuilds.size + }`, + ); - this.readyTimeout = null; + this.readyTimeout = null; - this.status = Status.READY; + this.status = Status.READY; - this.emit(ShardEvents.ALL_READY, this.expectedGuilds); - // }, hasGuildsIntent && waitGuildTimeout).unref(); - }, 1).unref(); + this.emit(ShardEvents.ALL_READY, this.expectedGuilds); + // }, hasGuildsIntent && waitGuildTimeout).unref(); + }, + this.expectedGuilds.size == 0 ? 1 : waitGuildTimeout, + ).unref(); } /**