mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-19 07:20:00 +00:00
21 lines
584 B
TypeScript
21 lines
584 B
TypeScript
![]() |
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);
|
||
|
}
|