mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-08 03:27:20 +00:00
Typed log functions + more
This commit is contained in:
parent
d2ac700143
commit
bed6589d48
166 changed files with 4021 additions and 869 deletions
|
@ -1,14 +1,17 @@
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { differenceToString, getScalarDifference } from "../../../utils";
|
||||
import { channelToConfigAccessibleChannel } from "../../../utils/configAccessibleObjects";
|
||||
import { channelToTemplateSafeChannel } from "../../../utils/templateSafeObjects";
|
||||
import { logsEvt } from "../types";
|
||||
import { logThreadCreate } from "../logFunctions/logThreadCreate";
|
||||
import { logThreadDelete } from "../logFunctions/logThreadDelete";
|
||||
import { logThreadUpdate } from "../logFunctions/logThreadUpdate";
|
||||
|
||||
export const LogsThreadCreateEvt = logsEvt({
|
||||
event: "threadCreate",
|
||||
|
||||
async listener(meta) {
|
||||
meta.pluginData.state.guildLogs.log(LogType.THREAD_CREATE, {
|
||||
thread: channelToConfigAccessibleChannel(meta.args.thread),
|
||||
logThreadCreate(meta.pluginData, {
|
||||
thread: meta.args.thread,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
@ -17,8 +20,8 @@ export const LogsThreadDeleteEvt = logsEvt({
|
|||
event: "threadDelete",
|
||||
|
||||
async listener(meta) {
|
||||
meta.pluginData.state.guildLogs.log(LogType.THREAD_DELETE, {
|
||||
thread: channelToConfigAccessibleChannel(meta.args.thread),
|
||||
logThreadDelete(meta.pluginData, {
|
||||
thread: meta.args.thread,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
@ -30,14 +33,10 @@ export const LogsThreadUpdateEvt = logsEvt({
|
|||
const diff = getScalarDifference(meta.args.oldThread, meta.args.newThread, ["messageCount", "archiveTimestamp"]);
|
||||
const differenceString = differenceToString(diff);
|
||||
|
||||
meta.pluginData.state.guildLogs.log(
|
||||
LogType.THREAD_UPDATE,
|
||||
{
|
||||
oldThread: channelToConfigAccessibleChannel(meta.args.oldThread),
|
||||
newThread: channelToConfigAccessibleChannel(meta.args.newThread),
|
||||
differenceString,
|
||||
},
|
||||
meta.args.newThread.id,
|
||||
);
|
||||
logThreadUpdate(meta.pluginData, {
|
||||
oldThread: meta.args.oldThread,
|
||||
newThread: meta.args.newThread,
|
||||
differenceString,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue