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

Migrate Spam to new Plugin structure

This commit is contained in:
Dark 2020-07-26 16:05:49 +02:00
parent 140ba84544
commit 4f831f6bf6
14 changed files with 622 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import { PluginData } from "knub";
import { SpamPluginType, RecentActionType } from "../types";
import { SavedMessage } from "src/data/entities/SavedMessage";
import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam";
export async function logCensor(pluginData: PluginData<SpamPluginType>, savedMessage: SavedMessage) {
const config = pluginData.config.getMatchingConfig({
userId: savedMessage.user_id,
channelId: savedMessage.channel_id,
});
const spamConfig = config.max_censor;
if (spamConfig) {
logAndDetectMessageSpam(
pluginData,
savedMessage,
RecentActionType.Censor,
spamConfig,
1,
"too many censored messages",
);
}
}