feat: DiscordAPIError debug
This commit is contained in:
parent
a8c08822ff
commit
7f5df8fddb
@ -58,6 +58,12 @@ class DiscordAPIError extends Error {
|
||||
json: request.options.data,
|
||||
files: request.options.files ?? [],
|
||||
};
|
||||
|
||||
/**
|
||||
* The number of times this request has been retried
|
||||
* @type {number}
|
||||
*/
|
||||
this.retries = request.retries;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -389,7 +389,7 @@ class RequestHandler {
|
||||
if (
|
||||
data?.captcha_service &&
|
||||
this.manager.client.options.captchaService &&
|
||||
request.retries < 4 &&
|
||||
request.retries <= this.manager.client.options.captchaRetryLimit &&
|
||||
captchaMessage.some(s => data.captcha_key[0].includes(s))
|
||||
) {
|
||||
// Retry the request after a captcha is solved
|
||||
|
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@ -1273,6 +1273,7 @@ export class DiscordAPIError extends Error {
|
||||
public path: string;
|
||||
public httpStatus: number;
|
||||
public requestData: HTTPErrorData;
|
||||
public retries: number;
|
||||
}
|
||||
|
||||
export class DMChannel extends TextBasedChannelMixin(Channel, [
|
||||
@ -4911,6 +4912,7 @@ export interface ClientOptions {
|
||||
captchaService?: captchaServices;
|
||||
captchaKey?: string;
|
||||
captchaSolver?: (data: Captcha, userAgent: string) => Promise<string>;
|
||||
captchaRetryLimit?: number;
|
||||
interactionTimeout?: number;
|
||||
usingNewAttachmentAPI?: boolean;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user