mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 01:01:30 +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>}
|
* @returns {Promise<number>}
|
||||||
*/
|
*/
|
||||||
fetchGuildCount(timeout = 3000) {
|
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.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._guildCountPromise = new Promise((resolve, reject) => {
|
||||||
this._guildCount = 0;
|
this._guildCount = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue