From 320bf7bb7290028ff18de50ddd911d894ddb6697 Mon Sep 17 00:00:00 2001 From: nazmigorkem Date: Fri, 30 Jun 2023 15:42:38 +0300 Subject: [PATCH 1/2] added port option to rest options --- index.d.ts | 1 + lib/rest/RequestHandler.js | 1 + 2 files changed, 2 insertions(+) diff --git a/index.d.ts b/index.d.ts index aac40315..419f660e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -478,6 +478,7 @@ declare namespace Dysnomia { baseURL?: string; disableLatencyCompensation?: boolean; domain?: string; + port?: string; https?: boolean; latencyThreshold?: number; ratelimiterOffset?: number; diff --git a/lib/rest/RequestHandler.js b/lib/rest/RequestHandler.js index ae549b8e..2a60c799 100644 --- a/lib/rest/RequestHandler.js +++ b/lib/rest/RequestHandler.js @@ -153,6 +153,7 @@ class RequestHandler { req = requester.request({ method: method, host: this.options.domain, + port: this.options.port, path: this.options.baseURL + finalURL, headers: headers, agent: this.options.agent From e42176c46a6cc71373c750e67653f77153b8cd86 Mon Sep 17 00:00:00 2001 From: TTtie Date: Fri, 30 Jun 2023 23:14:45 +0000 Subject: [PATCH 2/2] Add docs for the new option --- lib/Client.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Client.js b/lib/Client.js index 744b582a..b1ca1545 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -124,6 +124,7 @@ class Client extends EventEmitter { * @arg {String} [options.rest.domain="discord.com"] The domain to use for API requests * @arg {Boolean} [options.rest.https=true] Whether to make requests to the Discord API over HTTPS (true) or HTTP (false) * @arg {Number} [options.rest.latencyThreshold=30000] The average request latency at which Dysnomia will start emitting latency errors + * @arg {Number} [options.rest.port] The port to use for API requests. Defaults to 443 (HTTPS) or 80 (HTTP) * @arg {Number} [options.rest.ratelimiterOffset=0] A number of milliseconds to offset the ratelimit timing calculations by * @arg {Number} [options.rest.requestTimeout=15000] A number of milliseconds before REST requests are considered timed out * @arg {Boolean} [options.restMode=false] Whether to enable getting objects over REST. Even with this option enabled, it is recommended that you check the cache first before using REST