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:
parent
140ba84544
commit
4f831f6bf6
14 changed files with 622 additions and 0 deletions
23
backend/src/plugins/Spam/util/logCensor.ts
Normal file
23
backend/src/plugins/Spam/util/logCensor.ts
Normal 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",
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue