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

Add queue for massbans

This commit is contained in:
Dragory 2021-05-22 13:47:10 +03:00
parent 0ea1ab4b46
commit c30c9f6224
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 98 additions and 64 deletions

View file

@ -34,7 +34,7 @@ import { Member, Message } from "eris";
import { kickMember } from "./functions/kickMember";
import { banUserId } from "./functions/banUserId";
import { MassmuteCmd } from "./commands/MassmuteCmd";
import { trimPluginDescription } from "../../utils";
import { MINUTES, trimPluginDescription } from "../../utils";
import { DeleteCaseCmd } from "./commands/DeleteCaseCmd";
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
import { GuildTempbans } from "../../data/GuildTempbans";
@ -44,6 +44,7 @@ import { mapToPublicFn } from "../../pluginUtils";
import { onModActionsEvent } from "./functions/onModActionsEvent";
import { offModActionsEvent } from "./functions/offModActionsEvent";
import { updateCase } from "./functions/updateCase";
import { Queue } from "../../Queue";
const defaultOptions = {
config: {
@ -197,6 +198,9 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()("mod
state.unloaded = false;
state.outdatedTempbansTimeout = null;
state.ignoredEvents = [];
// Massbans can take a while depending on rate limits,
// so we're giving each massban 15 minutes to complete before launching the next massban
state.massbanQueue = new Queue(15 * MINUTES);
state.events = new EventEmitter();