mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
Return the existing promise instead of erroring
This commit is contained in:
parent
7f652f7df8
commit
90f05a34cb
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue