mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03: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>}
|
* @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;
|
||||||
|
|||||||
Reference in New Issue
Block a user