mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
automod: ensure actions only apply once per user/member
This commit is contained in:
parent
e55a1e3bd6
commit
c39d69dd5d
9 changed files with 27 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
|||
import * as t from "io-ts";
|
||||
import { automodAction } from "../helpers";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { asyncMap, resolveMember, tNullable } from "../../../utils";
|
||||
import { asyncMap, resolveMember, tNullable, unique } from "../../../utils";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
||||
|
||||
|
@ -23,7 +23,7 @@ export const WarnAction = automodAction({
|
|||
],
|
||||
};
|
||||
|
||||
const userIdsToWarn = contexts.map(c => c.user?.id).filter(Boolean);
|
||||
const userIdsToWarn = unique(contexts.map(c => c.user?.id).filter(Boolean));
|
||||
const membersToWarn = await asyncMap(userIdsToWarn, id => resolveMember(pluginData.client, pluginData.guild, id));
|
||||
|
||||
const modActions = pluginData.getPlugin(ModActionsPlugin);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue