mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
refactor(Client): remove fetchAllMembers option (#5257)
* feat(Client): remove fetchAllMembers option & logic * Cleanup * Missed type change
This commit is contained in:
committed by
GitHub
parent
41bd6c2717
commit
aaed72b723
@@ -391,27 +391,12 @@ class WebSocketManager extends EventEmitter {
|
||||
* Checks whether the client is ready to be marked as ready.
|
||||
* @private
|
||||
*/
|
||||
async checkShardsReady() {
|
||||
checkShardsReady() {
|
||||
if (this.status === Status.READY) return;
|
||||
if (this.shards.size !== this.totalShards || this.shards.some(s => s.status !== Status.READY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.status = Status.NEARLY;
|
||||
|
||||
if (this.client.options.fetchAllMembers) {
|
||||
try {
|
||||
const promises = this.client.guilds.cache.map(guild => {
|
||||
if (guild.available) return guild.members.fetch();
|
||||
// Return empty promise if guild is unavailable
|
||||
return Promise.resolve();
|
||||
});
|
||||
await Promise.all(promises);
|
||||
} catch (err) {
|
||||
this.debug(`Failed to fetch all members before ready! ${err}\n${err.stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
this.triggerClientReady();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user