3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Change DiscordRESTError to DiscordAPIError

This commit is contained in:
Dark 2021-06-30 23:06:02 +02:00
parent be71357ff9
commit 1ad70ffe1a
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
18 changed files with 50 additions and 50 deletions

View file

@ -70,13 +70,13 @@ export function isValidSnowflake(str: string) {
}
export const DISCORD_HTTP_ERROR_NAME = "DiscordHTTPError";
export const DISCORD_REST_ERROR_NAME = "DiscordRESTError";
export const DISCORD_REST_ERROR_NAME = "DiscordAPIError";
export function isDiscordHTTPError(err: Error | string) {
return typeof err === "object" && err.constructor?.name === DISCORD_HTTP_ERROR_NAME;
}
export function isDiscordRESTError(err: Error | string) {
export function isDiscordAPIError(err: Error | string) {
return typeof err === "object" && err.constructor?.name === DISCORD_REST_ERROR_NAME;
}
@ -470,7 +470,7 @@ export async function findRelevantAuditLogEntry(
try {
auditLogs = await guild.fetchAuditLogs({ limit: 5, type: actionType });
} catch (e) {
if (isDiscordRESTError(e) && e.code === 50013) {
if (isDiscordAPIError(e) && e.code === 50013) {
// If we don't have permission to read audit log, set audit log requests on cooldown
auditLogNextAttemptAfterFail.set(guild.id, Date.now() + AUDIT_LOG_FAIL_COOLDOWN);
} else if (isDiscordHTTPError(e) && e.code === 500) {