mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Ignore request timeouts when getting audit logs
This commit is contained in:
parent
3d1ecc8190
commit
ad24d166ce
1 changed files with 7 additions and 8 deletions
|
@ -392,17 +392,16 @@ export async function findRelevantAuditLogEntry(
|
||||||
try {
|
try {
|
||||||
auditLogs = await guild.getAuditLogs(5, null, actionType);
|
auditLogs = await guild.getAuditLogs(5, null, actionType);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Ignore internal server errors which seem to be pretty common with audit log requests
|
|
||||||
if (!isDiscordHTTPError(e) || e.code !== 500) {
|
|
||||||
// Ignore, try again next attempt
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we don't have permission to read audit log, set audit log requests on cooldown
|
|
||||||
if (isDiscordRESTError(e) && e.code === 50013) {
|
if (isDiscordRESTError(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);
|
auditLogNextAttemptAfterFail.set(guild.id, Date.now() + AUDIT_LOG_FAIL_COOLDOWN);
|
||||||
|
} else if (isDiscordHTTPError(e) && e.code === 500) {
|
||||||
|
// Ignore internal server errors which seem to be pretty common with audit log requests
|
||||||
|
} else if (e.message.startsWith("Request timed out")) {
|
||||||
|
// Ignore timeouts, try again next loop
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const entries = auditLogs ? auditLogs.entries : [];
|
const entries = auditLogs ? auditLogs.entries : [];
|
||||||
|
|
Loading…
Add table
Reference in a new issue