mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Return the existing promise instead of erroring
This commit is contained in:
@@ -97,8 +97,8 @@ class ShardingManager extends EventEmitter {
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
fetchGuildCount(timeout = 3000) {
|
||||
if (this._guildCountPromise) return Promise.reject(new Error('Already fetching guild count.'));
|
||||
if (this.shards.size !== this.totalShards) return Promise.reject(new Error('Still spawning shards.'));
|
||||
if (this._guildCountPromise) return this._guildCountPromise;
|
||||
|
||||
this._guildCountPromise = new Promise((resolve, reject) => {
|
||||
this._guildCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user