3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 04:25:01 +00:00

automod: fix spam filters counting edits multiple times

This commit is contained in:
Dragory 2020-08-02 03:23:12 +03:00
parent 9bbd245388
commit 6caf7b1304
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,13 @@
import { AutomodContext, AutomodPluginType } from "../types";
import { PluginData } from "knub";
import { RECENT_ACTION_EXPIRY_TIME, RecentActionType } from "../constants";
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
export function clearRecentActionsForMessage(pluginData: PluginData<AutomodPluginType>, context: AutomodContext) {
const globalIdentifier = context.message.user_id;
const perChannelIdentifier = `${context.message.channel_id}-${context.message.user_id}`;
pluginData.state.recentActions = pluginData.state.recentActions.filter(act => {
return act.identifier !== globalIdentifier && act.identifier !== perChannelIdentifier;
});
}