From fbaf7ed7c8407fbbc836365781b0ac1d28191add Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sun, 30 Apr 2023 21:43:41 +0700 Subject: [PATCH] Update RemoteAuth.js --- src/util/RemoteAuth.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/RemoteAuth.js b/src/util/RemoteAuth.js index d1a67a2..19d9bb0 100644 --- a/src/util/RemoteAuth.js +++ b/src/util/RemoteAuth.js @@ -107,15 +107,15 @@ class DiscordAuthWebsocket extends EventEmitter { * @returns {Promise} Captcha token */ // eslint-disable-next-line no-unused-vars - this.captchaHandler = data => + this.captchaSolver = data => new Promise((resolve, reject) => { reject( new Error(` -Captcha Handler not found - Please set captchaHandler option -Example captchaHandler function: +Captcha Handler not found - Please set captchaSolver option +Example captchaSolver function: new DiscordAuthWebsocket({ - captchaHandler: async (data) => { + captchaSolver: async (data) => { const token = await hcaptchaSolver(data.captcha_sitekey, 'discord.com'); return token; } @@ -157,7 +157,7 @@ new DiscordAuthWebsocket({ apiVersion: 9, userAgent: defaultUA, wsProperties: defaultClientOptions.ws.properties, - captchaHandler: () => new Error('Captcha Handler not found. Please set captchaHandler option.'), + captchaSolver: () => new Error('Captcha Handler not found. Please set captchaSolver option.'), }; if (typeof options == 'object') { if (typeof options.debug == 'boolean') this.options.debug = options.debug; @@ -168,7 +168,7 @@ new DiscordAuthWebsocket({ if (typeof options.apiVersion == 'number') this.options.apiVersion = options.apiVersion; if (typeof options.userAgent == 'string') this.options.userAgent = options.userAgent; if (typeof options.wsProperties == 'object') this.options.wsProperties = options.wsProperties; - if (typeof options.captchaHandler == 'function') this.captchaHandler = options.captchaHandler; + if (typeof options.captchaSolver == 'function') this.captchaSolver = options.captchaSolver; } } _createWebSocket(url) { @@ -474,8 +474,8 @@ new DiscordAuthWebsocket({ }); if (!res && this.captchaCache) { this._logger('default', 'Captcha is detected. Please solve the captcha to continue.'); - this._logger('debug', 'Try call captchaHandler()', this.captchaCache); - const token = await this.options.captchaHandler(this.captchaCache); + this._logger('debug', 'Try call captchaSolver()', this.captchaCache); + const token = await this.options.captchaSolver(this.captchaCache); return this._findRealToken(token); } this.realToken = this._decryptPayload(res.data.encrypted_token).toString();