mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 04:45:02 +00:00
Add missing logtypes, add change visualization
This commit is contained in:
parent
144c9c43e0
commit
968889e529
8 changed files with 80 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { differenceToString, getScalarDifference, stripObjectToScalars } from "../../../utils";
|
||||
import { logsEvt } from "../types";
|
||||
|
||||
export const LogsChannelCreateEvt = logsEvt({
|
||||
|
@ -21,3 +21,18 @@ export const LogsChannelDeleteEvt = logsEvt({
|
|||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const LogsChannelUpdateEvt = logsEvt({
|
||||
event: "channelUpdate",
|
||||
|
||||
async listener(meta) {
|
||||
const diff = getScalarDifference(meta.args.oldChannel, meta.args.newChannel);
|
||||
const differenceString = differenceToString(diff);
|
||||
|
||||
meta.pluginData.state.guildLogs.log(LogType.CHANNEL_UPDATE, {
|
||||
oldChannel: stripObjectToScalars(meta.args.oldChannel),
|
||||
newChannel: stripObjectToScalars(meta.args.newChannel),
|
||||
differenceString,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { differenceToString, getScalarDifference, stripObjectToScalars } from "../../../utils";
|
||||
import { logsEvt } from "../types";
|
||||
|
||||
export const LogsRoleCreateEvt = logsEvt({
|
||||
|
@ -21,3 +21,18 @@ export const LogsRoleDeleteEvt = logsEvt({
|
|||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const LogsRoleUpdateEvt = logsEvt({
|
||||
event: "roleUpdate",
|
||||
|
||||
async listener(meta) {
|
||||
const diff = getScalarDifference(meta.args.oldRole, meta.args.newRole);
|
||||
const differenceString = differenceToString(diff);
|
||||
|
||||
meta.pluginData.state.guildLogs.log(LogType.ROLE_UPDATE, {
|
||||
newRole: stripObjectToScalars(meta.args.newRole),
|
||||
oldRole: stripObjectToScalars(meta.args.oldRole),
|
||||
differenceString,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { differenceToString, getScalarDifference, stripObjectToScalars } from "../../../utils";
|
||||
import { logsEvt } from "../types";
|
||||
|
||||
export const LogsStageInstanceCreateEvt = logsEvt({
|
||||
|
@ -37,10 +37,15 @@ export const LogsStageInstanceUpdateEvt = logsEvt({
|
|||
const stageChannel =
|
||||
meta.args.newStageInstance.channel ??
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.newStageInstance.channelID));
|
||||
|
||||
const diff = getScalarDifference(meta.args.oldStageInstance, meta.args.newStageInstance);
|
||||
const differenceString = differenceToString(diff);
|
||||
|
||||
meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_UPDATE, {
|
||||
oldStageInstance: stripObjectToScalars(meta.args.oldStageInstance),
|
||||
newStageInstance: stripObjectToScalars(meta.args.newStageInstance),
|
||||
stageChannel: stripObjectToScalars(stageChannel),
|
||||
differenceString,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { stripObjectToScalars, getScalarDifference, differenceToString } from "../../../utils";
|
||||
import { logsEvt } from "../types";
|
||||
|
||||
export const LogsThreadCreateEvt = logsEvt({
|
||||
|
@ -26,9 +26,13 @@ export const LogsThreadUpdateEvt = logsEvt({
|
|||
event: "threadUpdate",
|
||||
|
||||
async listener(meta) {
|
||||
const diff = getScalarDifference(meta.args.oldThread, meta.args.newThread, ["messageCount", "archiveTimestamp"]);
|
||||
const differenceString = differenceToString(diff);
|
||||
|
||||
meta.pluginData.state.guildLogs.log(LogType.THREAD_UPDATE, {
|
||||
oldThread: stripObjectToScalars(meta.args.oldThread),
|
||||
newThread: stripObjectToScalars(meta.args.newThread),
|
||||
differenceString,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue