From b0c348b50dd083e8a2865f40f3231ee7872517c7 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Mon, 29 Aug 2022 11:26:25 +0700 Subject: [PATCH] fix(Ws): args.proxy => args.agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Nguyễn Hồng Đức --- src/client/Client.js | 2 +- src/client/websocket/WebSocketShard.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index 4000c93..48b0e51 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -397,7 +397,7 @@ class Client extends BaseClient { autoLogin: true, debug, }); - this.emit(Events.DEBUG, `Preparing to connect to the gateway`, QR); + this.emit(Events.DEBUG, `Preparing to connect to the gateway (QR Login)`, QR); return QR.connect(this); } diff --git a/src/client/websocket/WebSocketShard.js b/src/client/websocket/WebSocketShard.js index 3ed6440..b13447e 100644 --- a/src/client/websocket/WebSocketShard.js +++ b/src/client/websocket/WebSocketShard.js @@ -271,7 +271,10 @@ class WebSocketShard extends EventEmitter { this.connectedAt = Date.now(); let args = { handshakeTimeout: 30_000 }; - if (typeof client.options.proxy && client.options.proxy.length > 0) args.proxy = new proxy(client.options.proxy); + if (typeof client.options.proxy && client.options.proxy.length > 0) { + args.agent = new proxy(client.options.proxy); + this.debug(`Using proxy ${client.options.proxy}`, args); + } // Adding a handshake timeout to just make sure no zombie connection appears. const ws = (this.connection = WebSocket.create(gateway, wsQuery, args)); ws.onopen = this.onOpen.bind(this);