Migrate Logs to new Plugin structure, also dont ignore it

This commit is contained in:
Dark 2020-07-27 01:53:14 +02:00
parent 140ba84544
commit aea019181c
16 changed files with 764 additions and 1 deletions

View file

@ -0,0 +1,37 @@
import { logsEvent } from "../types";
import { stripObjectToScalars } from "src/utils";
import { LogType } from "src/data/LogType";
export const LogsVoiceJoinEvt = logsEvent({
event: "voiceChannelJoin",
async listener(meta) {
meta.pluginData.state.guildLogs.log(LogType.VOICE_CHANNEL_JOIN, {
member: stripObjectToScalars(meta.args.member, ["user", "roles"]),
channel: stripObjectToScalars(meta.args.newChannel),
});
},
});
export const LogsVoiceLeaveEvt = logsEvent({
event: "voiceChannelLeave",
async listener(meta) {
meta.pluginData.state.guildLogs.log(LogType.VOICE_CHANNEL_LEAVE, {
member: stripObjectToScalars(meta.args.member, ["user", "roles"]),
channel: stripObjectToScalars(meta.args.oldChannel),
});
},
});
export const LogsVoiceSwitchEvt = logsEvent({
event: "voiceChannelSwitch",
async listener(meta) {
meta.pluginData.state.guildLogs.log(LogType.VOICE_CHANNEL_MOVE, {
member: stripObjectToScalars(meta.args.member, ["user", "roles"]),
oldChannel: stripObjectToScalars(meta.args.oldChannel),
newChannel: stripObjectToScalars(meta.args.newChannel),
});
},
});