3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-23 09:35:02 +00:00
zeppelin/backend/src/plugins/Automod/functions/clearOldRecentActions.ts
2021-09-08 23:12:31 +01:00

10 lines
421 B
TypeScript

import { GuildPluginData } from "knub";
import { RECENT_ACTION_EXPIRY_TIME } from "../constants";
import { AutomodPluginType } from "../types";
export function clearOldRecentActions(pluginData: GuildPluginData<AutomodPluginType>) {
const now = Date.now();
pluginData.state.recentActions = pluginData.state.recentActions.filter((info) => {
return info.context.timestamp + RECENT_ACTION_EXPIRY_TIME > now;
});
}