feat(DiscordAPIErrror): Support Captcha solve service

This commit is contained in:
March 7th 2022-06-16 18:20:18 +07:00
parent 43599b376e
commit 9af5d8954a

View File

@ -25,7 +25,7 @@ class DiscordAPIError extends Error {
/** /**
* HTTP error code returned by Discord * HTTP error code returned by Discord
* @type {number} * @type {number | string}
*/ */
this.code = error.code; this.code = error.code;
@ -35,6 +35,19 @@ class DiscordAPIError extends Error {
*/ */
this.httpStatus = status; this.httpStatus = status;
/**
* @typedef {Object} Captcha
* @property {Array<string>} captcha_key ['captcha-required']
* @property {string} captcha_sitekey Captcha code ???
* @property {string} captcha_service hcaptcha
*/
/**
* 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 * The data associated with the request that caused this error
* @type {HTTPErrorData} * @type {HTTPErrorData}