WIP ModActions
This commit is contained in:
parent
a3d0ec03d9
commit
ebcb28261b
25 changed files with 1162 additions and 6 deletions
20
backend/src/plugins/ModActions/functions/ignoreEvent.ts
Normal file
20
backend/src/plugins/ModActions/functions/ignoreEvent.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue