3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 16:55:03 +00:00
zeppelin/backend/src/plugins/Spam/events/SpamVoiceEvt.ts

28 lines
789 B
TypeScript

import { RecentActionType, spamEvt } from "../types";
import { logAndDetectOtherSpam } from "../util/logAndDetectOtherSpam";
export const SpamVoiceStateUpdateEvt = spamEvt({
event: "voiceStateUpdate",
async listener(meta) {
const member = meta.args.newState.member;
if (!member) return;
const channel = meta.args.newState.channel!;
const config = await 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",
);
}
},
});