Closed Ortovoxx closed 3 years ago
should emit Events.CLIENT_READY, not ShardEvents.READY, no?
Anyway no need to overcomplicate it. This should work:
this.on(Discord.Constants.Events.SHARD_RESUME, () => {
if(!this.readyAt) { this.ws.checkShardReady(); }
})
Yes you're right it should be CLIENT_READY
it doesn't make much of a difference because both constants are "ready" and so it emits the same event but I will add it in for completeness
Not quite sure what you mean with checkShardReady
? That method doesn't seem to exist?
The reason I added the extra logic is to only emit the ready event once all shards were ready not just the first one.
checkShardReady does exactly that
https://github.com/discordjs/discord.js/blob/master/src/client/websocket/WebSocketManager.js#L394
also, its better to use Discord.Constants.Events rather than import Constants from discord.js to account for possible modifications done to Discord in classes.js
Noted. Added those changes. Couldn't find that method but seems to do exactly what I intended ahaha
Thanks
The ready event will now fire when all shards are ready