Automod work

This commit is contained in:
Dragory 2020-07-27 20:42:10 +03:00
parent 140ba84544
commit f657b169df
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
32 changed files with 1099 additions and 5 deletions

View file

@ -0,0 +1,20 @@
import { PluginData } from "knub";
import { AutomodPluginType } from "../types";
import { RecentActionType } from "../constants";
export function getMatchingRecentActions(
pluginData: PluginData<AutomodPluginType>,
type: RecentActionType,
identifier: string | null,
since: number,
to: number,
) {
return pluginData.state.recentActions.filter(action => {
return (
action.type === type &&
(!identifier || action.identifier === identifier) &&
action.context.timestamp >= since &&
action.context.timestamp <= to
);
});
}