mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Add excluded_categories option to log channels
This commit is contained in:
parent
303124a6eb
commit
2650ab81a5
2 changed files with 17 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -43,6 +43,22 @@ export async function log(pluginData: GuildPluginData<LogsPluginType>, 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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue