More rework progress, mostly done up to ModActions
This commit is contained in:
parent
52839cc9f3
commit
57893e7f76
38 changed files with 199 additions and 241 deletions
|
@ -1,46 +1,34 @@
|
|||
import { logsEvt } from "../types";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
/** Merge into single event
|
||||
export const LogsVoiceJoinEvt = logsEvt({
|
||||
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 = logsEvt({
|
||||
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 = logsEvt({
|
||||
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),
|
||||
});
|
||||
},
|
||||
});
|
||||
**/
|
||||
|
||||
export const LogsVoiceStateUpdateEvt = logsEvt({
|
||||
event: "voiceStateUpdate",
|
||||
|
||||
async listener(meta) {
|
||||
console.error(`Fixme @LogsVoiceChannelEvts.ts`);
|
||||
const oldChannel = meta.args.oldState.channel;
|
||||
const newChannel = meta.args.newState.channel;
|
||||
const member = meta.args.newState.member ?? meta.args.oldState.member!;
|
||||
|
||||
if (!newChannel) { // Leave evt
|
||||
meta.pluginData.state.guildLogs.log(LogType.VOICE_CHANNEL_LEAVE, {
|
||||
member: stripObjectToScalars(member, ["user", "roles"]),
|
||||
oldChannel: stripObjectToScalars(oldChannel),
|
||||
newChannel: stripObjectToScalars(newChannel),
|
||||
});
|
||||
} else if (!oldChannel) { // Join Evt
|
||||
meta.pluginData.state.guildLogs.log(LogType.VOICE_CHANNEL_JOIN, {
|
||||
member: stripObjectToScalars(member, ["user", "roles"]),
|
||||
oldChannel: stripObjectToScalars(oldChannel),
|
||||
newChannel: stripObjectToScalars(newChannel),
|
||||
});
|
||||
} else {
|
||||
meta.pluginData.state.guildLogs.log(LogType.VOICE_CHANNEL_MOVE, {
|
||||
member: stripObjectToScalars(member, ["user", "roles"]),
|
||||
oldChannel: stripObjectToScalars(oldChannel),
|
||||
newChannel: stripObjectToScalars(newChannel),
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue