mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Add logging for threads and stages
This commit is contained in:
parent
bb9b8cfe06
commit
144c9c43e0
5 changed files with 108 additions and 0 deletions
|
@ -15,6 +15,12 @@ import { LogsChannelCreateEvt, LogsChannelDeleteEvt } from "./events/LogsChannel
|
|||
import { LogsGuildMemberAddEvt } from "./events/LogsGuildMemberAddEvt";
|
||||
import { LogsGuildMemberRemoveEvt } from "./events/LogsGuildMemberRemoveEvt";
|
||||
import { LogsRoleCreateEvt, LogsRoleDeleteEvt } from "./events/LogsRoleModifyEvts";
|
||||
import {
|
||||
LogsStageInstanceCreateEvt,
|
||||
LogsStageInstanceDeleteEvt,
|
||||
LogsStageInstanceUpdateEvt,
|
||||
} from "./events/LogsStageInstanceModifyEvts";
|
||||
import { LogsThreadCreateEvt, LogsThreadDeleteEvt, LogsThreadUpdateEvt } from "./events/LogsThreadModifyEvts";
|
||||
import { LogsGuildMemberUpdateEvt } from "./events/LogsUserUpdateEvts";
|
||||
import { LogsVoiceStateUpdateEvt } from "./events/LogsVoiceChannelEvts";
|
||||
import { ConfigSchema, FORMAT_NO_TIMESTAMP, LogsPluginType } from "./types";
|
||||
|
@ -67,6 +73,12 @@ export const LogsPlugin = zeppelinGuildPlugin<LogsPluginType>()({
|
|||
LogsRoleCreateEvt,
|
||||
LogsRoleDeleteEvt,
|
||||
LogsVoiceStateUpdateEvt,
|
||||
LogsStageInstanceCreateEvt,
|
||||
LogsStageInstanceDeleteEvt,
|
||||
LogsStageInstanceUpdateEvt,
|
||||
LogsThreadCreateEvt,
|
||||
LogsThreadDeleteEvt,
|
||||
LogsThreadUpdateEvt,
|
||||
],
|
||||
|
||||
public: {
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { logsEvt } from "../types";
|
||||
|
||||
export const LogsStageInstanceCreateEvt = logsEvt({
|
||||
event: "stageInstanceCreate",
|
||||
|
||||
async listener(meta) {
|
||||
const stageChannel =
|
||||
meta.args.stageInstance.channel ??
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.stageInstance.channelID));
|
||||
meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_CREATE, {
|
||||
stageInstance: stripObjectToScalars(meta.args.stageInstance),
|
||||
stageChannel: stripObjectToScalars(stageChannel),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const LogsStageInstanceDeleteEvt = logsEvt({
|
||||
event: "stageInstanceDelete",
|
||||
|
||||
async listener(meta) {
|
||||
const stageChannel =
|
||||
meta.args.stageInstance.channel ??
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.stageInstance.channelID));
|
||||
meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_DELETE, {
|
||||
stageInstance: stripObjectToScalars(meta.args.stageInstance),
|
||||
stageChannel: stripObjectToScalars(stageChannel),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const LogsStageInstanceUpdateEvt = logsEvt({
|
||||
event: "stageInstanceUpdate",
|
||||
|
||||
async listener(meta) {
|
||||
const stageChannel =
|
||||
meta.args.newStageInstance.channel ??
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.newStageInstance.channelID));
|
||||
meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_UPDATE, {
|
||||
oldStageInstance: stripObjectToScalars(meta.args.oldStageInstance),
|
||||
newStageInstance: stripObjectToScalars(meta.args.newStageInstance),
|
||||
stageChannel: stripObjectToScalars(stageChannel),
|
||||
});
|
||||
},
|
||||
});
|
34
backend/src/plugins/Logs/events/LogsThreadModifyEvts.ts
Normal file
34
backend/src/plugins/Logs/events/LogsThreadModifyEvts.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars } from "../../../utils";
|
||||
import { logsEvt } from "../types";
|
||||
|
||||
export const LogsThreadCreateEvt = logsEvt({
|
||||
event: "threadCreate",
|
||||
|
||||
async listener(meta) {
|
||||
meta.pluginData.state.guildLogs.log(LogType.THREAD_CREATE, {
|
||||
thread: stripObjectToScalars(meta.args.thread),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const LogsThreadDeleteEvt = logsEvt({
|
||||
event: "threadDelete",
|
||||
|
||||
async listener(meta) {
|
||||
meta.pluginData.state.guildLogs.log(LogType.THREAD_DELETE, {
|
||||
thread: stripObjectToScalars(meta.args.thread),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const LogsThreadUpdateEvt = logsEvt({
|
||||
event: "threadUpdate",
|
||||
|
||||
async listener(meta) {
|
||||
meta.pluginData.state.guildLogs.log(LogType.THREAD_UPDATE, {
|
||||
oldThread: stripObjectToScalars(meta.args.oldThread),
|
||||
newThread: stripObjectToScalars(meta.args.newThread),
|
||||
});
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue