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,6 +1,7 @@
import { GuildPluginData } from "knub";
import { RecentActionType } from "../constants";
import { AutomodPluginType } from "../types";
import { startProfiling } from "../../../utils/easyProfiler";
export function getMatchingRecentActions(
pluginData: GuildPluginData<AutomodPluginType>,
@ -9,9 +10,10 @@ export function getMatchingRecentActions(
since: number,
to?: number,
) {
const stopProfiling = startProfiling(pluginData.getKnubInstance().profiler, "automod:fns:getMatchingRecentActions");
to = to || Date.now();
return pluginData.state.recentActions.filter((action) => {
const result = pluginData.state.recentActions.filter((action) => {
return (
action.type === type &&
(!identifier || action.identifier === identifier) &&
@ -20,4 +22,6 @@ export function getMatchingRecentActions(
!action.context.actioned
);
});
stopProfiling();
return result;
}