diff --git a/backend/src/plugins/Logs/types.ts b/backend/src/plugins/Logs/types.ts index 759d7581..6545b595 100644 --- a/backend/src/plugins/Logs/types.ts +++ b/backend/src/plugins/Logs/types.ts @@ -19,6 +19,7 @@ const LogChannel = t.partial({ excluded_users: t.array(t.string), excluded_message_regexes: t.array(TRegex), excluded_channels: t.array(t.string), + excluded_categories: t.array(t.string), format: tNullable(tLogFormats), timestamp_format: t.string, include_embed_timestamp: t.boolean, diff --git a/backend/src/plugins/Logs/util/log.ts b/backend/src/plugins/Logs/util/log.ts index 6abdedaa..f5aab896 100644 --- a/backend/src/plugins/Logs/util/log.ts +++ b/backend/src/plugins/Logs/util/log.ts @@ -43,6 +43,22 @@ export async function log(pluginData: GuildPluginData, type: Log } } + // If this entry is from an excluded category, skip it + if (opts.excluded_categories) { + if ( + type === LogType.MESSAGE_DELETE || + type === LogType.MESSAGE_DELETE_BARE || + type === LogType.MESSAGE_EDIT || + type === LogType.MESSAGE_SPAM_DETECTED || + type === LogType.CENSOR || + type === LogType.CLEAN + ) { + if (data.channel.parent_id && opts.excluded_categories.includes(data.channel.parent_id)) { + continue logChannelLoop; + } + } + } + // If this entry contains a message with an excluded regex, skip it if (type === LogType.MESSAGE_DELETE && opts.excluded_message_regexes && data.message.data.content) { for (const regex of opts.excluded_message_regexes) {