mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 04:45: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
52
backend/src/plugins/Spam/events/SpamVoiceEvt.ts
Normal file
52
backend/src/plugins/Spam/events/SpamVoiceEvt.ts
Normal file
|
@ -0,0 +1,52 @@
|
|||
import { spamEvent, RecentActionType } from "../types";
|
||||
import { logAndDetectOtherSpam } from "../util/logAndDetectOtherSpam";
|
||||
|
||||
export const SpamVoiceJoinEvt = spamEvent({
|
||||
event: "voiceChannelJoin",
|
||||
|
||||
async listener(meta) {
|
||||
const member = meta.args.member;
|
||||
const channel = meta.args.newChannel;
|
||||
|
||||
const config = meta.pluginData.config.getMatchingConfig({ member, channelId: channel.id });
|
||||
const maxVoiceMoves = config.max_voice_moves;
|
||||
if (maxVoiceMoves) {
|
||||
logAndDetectOtherSpam(
|
||||
meta.pluginData,
|
||||
RecentActionType.VoiceChannelMove,
|
||||
maxVoiceMoves,
|
||||
member.id,
|
||||
1,
|
||||
"0",
|
||||
Date.now(),
|
||||
null,
|
||||
"too many voice channel moves",
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export const SpamVoiceSwitchEvt = spamEvent({
|
||||
event: "voiceChannelSwitch",
|
||||
|
||||
async listener(meta) {
|
||||
const member = meta.args.member;
|
||||
const channel = meta.args.newChannel;
|
||||
|
||||
const config = meta.pluginData.config.getMatchingConfig({ member, channelId: channel.id });
|
||||
const maxVoiceMoves = config.max_voice_moves;
|
||||
if (maxVoiceMoves) {
|
||||
logAndDetectOtherSpam(
|
||||
meta.pluginData,
|
||||
RecentActionType.VoiceChannelMove,
|
||||
maxVoiceMoves,
|
||||
member.id,
|
||||
1,
|
||||
"0",
|
||||
Date.now(),
|
||||
null,
|
||||
"too many voice channel moves",
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue