fix(Ws): args.proxy => args.agent

Co-Authored-By: Nguyễn Hồng Đức <hongducyb123@gmail.com>
This commit is contained in:
March 7th 2022-08-29 11:26:25 +07:00
parent 00a2b8aa5b
commit b0c348b50d
2 changed files with 5 additions and 2 deletions

View File

@ -397,7 +397,7 @@ class Client extends BaseClient {
autoLogin: true, autoLogin: true,
debug, 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); return QR.connect(this);
} }

View File

@ -271,7 +271,10 @@ class WebSocketShard extends EventEmitter {
this.connectedAt = Date.now(); this.connectedAt = Date.now();
let args = { handshakeTimeout: 30_000 }; 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. // Adding a handshake timeout to just make sure no zombie connection appears.
const ws = (this.connection = WebSocket.create(gateway, wsQuery, args)); const ws = (this.connection = WebSocket.create(gateway, wsQuery, args));
ws.onopen = this.onOpen.bind(this); ws.onopen = this.onOpen.bind(this);