mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-22 17:25:01 +00:00
18 lines
559 B
TypeScript
18 lines
559 B
TypeScript
import { GuildPluginData } from "knub";
|
|
import { RecentActionType, SpamPluginType } from "../types";
|
|
|
|
export function getRecentActions(
|
|
pluginData: GuildPluginData<SpamPluginType>,
|
|
type: RecentActionType,
|
|
userId: string,
|
|
actionGroupId: string,
|
|
since: number,
|
|
) {
|
|
return pluginData.state.recentActions.filter(action => {
|
|
if (action.timestamp < since) return false;
|
|
if (action.type !== type) return false;
|
|
if (action.actionGroupId !== actionGroupId) return false;
|
|
if (action.userId !== userId) return false;
|
|
return true;
|
|
});
|
|
}
|