refactor(Client): remove fetchAllMembers option (#5257)

* feat(Client): remove fetchAllMembers option & logic

* Cleanup

* Missed type change
This commit is contained in:
Matt (IPv4) Cowley
2021-01-27 10:27:50 +00:00
committed by GitHub
parent 41bd6c2717
commit aaed72b723
7 changed files with 22 additions and 39 deletions

View File

@@ -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();
}