Add missing logtypes, add change visualization

This commit is contained in:
Dark 2021-07-01 04:40:39 +02:00
parent 144c9c43e0
commit 968889e529
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
8 changed files with 80 additions and 10 deletions

View file

@ -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,
});
},
});