3
0
Fork 0
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:
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,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",
);
}
},
});