From cca7d2ce661a07f9bf32bf8a97d009bcce455d02 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Thu, 30 Nov 2023 14:11:13 +0200 Subject: [PATCH 1/3] Update APIRequest.js Fix proxy-agent to version 5 --- src/rest/APIRequest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rest/APIRequest.js b/src/rest/APIRequest.js index 6659841..a75e722 100644 --- a/src/rest/APIRequest.js +++ b/src/rest/APIRequest.js @@ -35,8 +35,8 @@ class APIRequest { make(captchaKey = undefined, captchaRqtoken = undefined) { if (agent === null) { if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) { - const proxy = require('proxy-agent'); - agent = new proxy.ProxyAgent(this.client.options.proxy); + const ProxyAgent = require('proxy-agent'); + agent = new ProxyAgent(this.client.options.proxy); } else if (this.client.options.http.agent instanceof https.Agent) { agent = this.client.options.http.agent; agent.keepAlive = true; From cb03a1a9184f94b3efc997683f1bcc95c9edcd4a Mon Sep 17 00:00:00 2001 From: Ahmed Date: Thu, 30 Nov 2023 14:11:45 +0200 Subject: [PATCH 2/3] Update WebSocketShard.js fix proxy to proxy-agent v5 --- src/client/websocket/WebSocketShard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/websocket/WebSocketShard.js b/src/client/websocket/WebSocketShard.js index 2cbe384..a72a2ad 100644 --- a/src/client/websocket/WebSocketShard.js +++ b/src/client/websocket/WebSocketShard.js @@ -280,8 +280,8 @@ class WebSocketShard extends EventEmitter { let args = { handshakeTimeout: 30_000 }; if (client.options.proxy.length > 0) { - const proxy = require('proxy-agent'); - args.agent = new proxy.ProxyAgent(client.options.proxy); + const ProxyAgent = require('proxy-agent'); + args.agent = new ProxyAgent(client.options.proxy); this.debug(`Using proxy ${client.options.proxy}`, args); } // Adding a handshake timeout to just make sure no zombie connection appears. From ed012383685eb63edcad1fc17447f06c0a68d01b Mon Sep 17 00:00:00 2001 From: Ahmed Date: Thu, 30 Nov 2023 14:12:36 +0200 Subject: [PATCH 3/3] Update Client.js update proxy-agent to version 5 --- src/client/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/Client.js b/src/client/Client.js index 89ae934..b8ec2ac 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -1024,7 +1024,7 @@ class Client extends BaseClient { typeof options.proxy === 'string' && testImportModule('proxy-agent') === false ) { - throw new Error('MISSING_MODULE', 'proxy-agent', 'npm install proxy-agent'); + throw new Error('MISSING_MODULE', 'proxy-agent', 'npm install proxy-agent@5'); } if (typeof options.shardCount !== 'number' || isNaN(options.shardCount) || options.shardCount < 1) { throw new TypeError('CLIENT_INVALID_OPTION', 'shardCount', 'a number greater than or equal to 1');