diff --git a/src/client/websocket/WebSocketShard.js b/src/client/websocket/WebSocketShard.js index ab5b9216411d..02083a3ac6d6 100644 --- a/src/client/websocket/WebSocketShard.js +++ b/src/client/websocket/WebSocketShard.js @@ -474,17 +474,23 @@ class WebSocketShard extends EventEmitter { this.emit(ShardEvents.ALL_READY); return; } + let time = 15000; + if (!new Intents(this.manager.client.options.intents).has(Intents.FLAGS.GUILDS)) { + time = 0; + } // Step 2. Create a 15s timeout that will mark the shard as ready if there are still unavailable guilds this.readyTimeout = setTimeout(() => { - this.debug(`Shard did not receive any more guild packets in 15 seconds. - Unavailable guild count: ${this.expectedGuilds.size}`); + this.debug( + `Shard ${time === 0 ? 'will' : 'did'} not receive any more guild packets` + + `${time === 0 ? '' : ' in 15 seconds'}.\n Unavailable guild count: ${this.expectedGuilds.size}`, + ); this.readyTimeout = null; this.status = Status.READY; this.emit(ShardEvents.ALL_READY, this.expectedGuilds); - }, 15000).unref(); + }, time).unref(); } /** diff --git a/typings/index.d.ts b/typings/index.d.ts index 520f5b6bc8b2..8549af6eced8 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2047,7 +2047,7 @@ export class WebSocketShard extends EventEmitter { private onError(error: ErrorEvent | unknown): void; private onClose(event: CloseEvent): void; private onPacket(packet: unknown): void; - private checkReady(): void; + private checkReady(epxectGuilds?: boolean): void; private setHelloTimeout(time?: number): void; private setHeartbeatTimer(time: number): void; private sendHeartbeat(): void;