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:
parent
be71357ff9
commit
1ad70ffe1a
18 changed files with 50 additions and 50 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue