3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-19 07:20:00 +00:00
zeppelin/backend/src/plugins/ModActions/functions/ignoreEvent.ts

21 lines
584 B
TypeScript
Raw Normal View History

2020-07-23 00:37:33 +03:00
import { PluginData } from "knub";
import { IgnoredEventType, ModActionsPluginType } from "../types";
import { SECONDS } from "../../../utils";
import { clearIgnoredEvent } from "./clearIgnoredEvents";
const DEFAULT_TIMEOUT = 15 * SECONDS;
export function ignoreEvent(
pluginData: PluginData<ModActionsPluginType>,
type: IgnoredEventType,
userId: string,
timeout = DEFAULT_TIMEOUT,
) {
pluginData.state.ignoredEvents.push({ type, userId });
// Clear after expiry (15sec by default)
setTimeout(() => {
clearIgnoredEvent(pluginData, type, userId);
}, timeout);
}