mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
ModActions: ignore server errors when getting bans
This commit is contained in:
parent
a7507fa4ef
commit
4f8dc4f0ae
1 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
import { decorators as d, IPluginOptions, logger, waitForReaction, waitForReply } from "knub";
|
||||
import { Attachment, Constants as ErisConstants, Guild, Member, Message, TextChannel, User } from "eris";
|
||||
import DiscordRESTError from "eris/lib/errors/DiscordRESTError"; // tslint:disable-line
|
||||
import DiscordHTTPError from "eris/lib/errors/DiscordHTTPError"; // tslint:disable-line
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildCases } from "../data/GuildCases";
|
||||
import {
|
||||
|
@ -161,8 +162,16 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
}
|
||||
|
||||
async isBanned(userId): Promise<boolean> {
|
||||
try {
|
||||
const bans = (await this.guild.getBans()) as any;
|
||||
return bans.some(b => b.user.id === userId);
|
||||
} catch (e) {
|
||||
if (e instanceof DiscordHTTPError && e.code === 500) {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
async findRelevantAuditLogEntry(actionType: number, userId: string, attempts?: number, attemptDelay?: number) {
|
||||
|
|
Loading…
Add table
Reference in a new issue