From e6572caf6c2475e608cbe267abfb4645c935c5db Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Mon, 16 May 2016 15:01:50 -0700 Subject: [PATCH] guildCreateTimeout option --- docs/docs_client.rst | 5 +++++ lib/Client/Client.js | 1 + lib/Client/InternalClient.js | 2 +- src/Client/Client.js | 1 + src/Client/InternalClient.js | 2 +- 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/docs_client.rst b/docs/docs_client.rst index 9e01b139b..43a557851 100644 --- a/docs/docs_client.rst +++ b/docs/docs_client.rst @@ -29,6 +29,11 @@ forceFetchUsers Make the library get all the users in all guilds, and delay the ready event until all users are received. This will slow down ready times and increase initial network traffic. +guildCreateTimeout +~~~~~~~~~~~~~~~ + +How long in milliseconds to wait for more guilds during the initial ready stream. Default is 1000ms. Increase this number if you are getting some serverCreated events right after ready. + largeThreshold ~~~~~~~~~~~~~~ diff --git a/lib/Client/Client.js b/lib/Client/Client.js index 2b4ede57e..7ef639f56 100644 --- a/lib/Client/Client.js +++ b/lib/Client/Client.js @@ -76,6 +76,7 @@ var Client = (function (_EventEmitter) { this.options.rateLimitAsError = options.rateLimitAsError || false; this.options.largeThreshold = options.largeThreshold || 250; this.options.maxCachedMessages = options.maxCachedMessages || 1000; + this.options.guildCreateTimeout = options.guildCreateTimeout || 1000; /** * Internal Client that the Client wraps around. * @readonly diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index 2e7d40aa7..d106b24b9 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -462,7 +462,7 @@ var InternalClient = (function () { if (!this.readyTime) { this.guildCreateTimeout = setTimeout(function () { _this6.checkReady(); - }, 1000); + }, this.client.options.guildCreateTimeout); } }; diff --git a/src/Client/Client.js b/src/Client/Client.js index 4c285fb95..dec9d0a4c 100644 --- a/src/Client/Client.js +++ b/src/Client/Client.js @@ -50,6 +50,7 @@ export default class Client extends EventEmitter { this.options.rateLimitAsError = options.rateLimitAsError || false; this.options.largeThreshold = options.largeThreshold || 250; this.options.maxCachedMessages = options.maxCachedMessages || 1000; + this.options.guildCreateTimeout = options.guildCreateTimeout || 1000; /** * Internal Client that the Client wraps around. * @readonly diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 67130ccd2..89da4fe43 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -381,7 +381,7 @@ export default class InternalClient { if(!this.readyTime) { this.guildCreateTimeout = setTimeout(() => { this.checkReady(); - }, 1000); + }, this.client.options.guildCreateTimeout); } }