mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-12 13:37:19 +00:00
Migrate Spam to new Plugin structure
This commit is contained in:
parent
4b33322127
commit
ef35f17eca
14 changed files with 622 additions and 0 deletions
17
backend/src/plugins/Spam/util/getRecentActions.ts
Normal file
17
backend/src/plugins/Spam/util/getRecentActions.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { RecentActionType } from "../types";
|
||||
|
||||
export function getRecentActions(
|
||||
pluginData,
|
||||
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;
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue