Support Proxy + Custom Captcha solver

This commit is contained in:
Elysia
2024-01-12 23:24:43 +07:00
parent e48e9e8dd8
commit 6fbf181d20
6 changed files with 53 additions and 213 deletions

View File

@@ -25,7 +25,7 @@ class DiscordAPIError extends Error {
/**
* HTTP error code returned by Discord
* @type {number | string}
* @type {number}
*/
this.code = error.code;
@@ -35,21 +35,6 @@ class DiscordAPIError extends Error {
*/
this.httpStatus = status;
/**
* @typedef {Object} Captcha
* @property {Array<string>} captcha_key ['message']
* @property {string} captcha_sitekey Captcha sitekey (hcaptcha)
* @property {string} captcha_service hcaptcha
* @property {string} [captcha_rqdata]
* @property {string} [captcha_rqtoken]
*/
/**
* Captcha response data if the request requires a captcha
* @type {Captcha | null}
*/
this.captcha = error?.captcha_service ? error : null;
/**
* The data associated with the request that caused this error
* @type {HTTPErrorData}
@@ -64,6 +49,21 @@ class DiscordAPIError extends Error {
* @type {number}
*/
this.retries = request.retries;
/**
* @typedef {Object} Captcha
* @property {Array<string>} captcha_key ['message']
* @property {string} captcha_sitekey Captcha sitekey (hcaptcha)
* @property {string} captcha_service hcaptcha
* @property {string} [captcha_rqdata]
* @property {string} [captcha_rqtoken]
*/
/**
* Captcha response data if the request requires a captcha
* @type {Captcha | null}
*/
this.captcha = error?.captcha_service ? error : null;
}
/**