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

debug: re-enable Automod with extra profiling

This commit is contained in:
Dragory 2021-10-05 23:49:00 +03:00
parent 2d012bc5cf
commit 53d7491c1b
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
8 changed files with 43 additions and 8 deletions

View file

@ -1,10 +1,13 @@
import { GuildPluginData } from "knub";
import { RECENT_ACTION_EXPIRY_TIME } from "../constants";
import { AutomodPluginType } from "../types";
import { startProfiling } from "../../../utils/easyProfiler";
export function clearOldRecentActions(pluginData: GuildPluginData<AutomodPluginType>) {
const stopProfiling = startProfiling(pluginData.getKnubInstance().profiler, "automod:fns:clearOldRecentActions");
const now = Date.now();
pluginData.state.recentActions = pluginData.state.recentActions.filter((info) => {
return info.context.timestamp + RECENT_ACTION_EXPIRY_TIME > now;
});
stopProfiling();
}