3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Add exclude_bots option to log channels

This commit is contained in:
Dragory 2020-11-08 17:55:33 +02:00
parent 2650ab81a5
commit d65f5b99d7
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 10 additions and 0 deletions

View file

@ -20,6 +20,7 @@ const LogChannel = t.partial({
excluded_message_regexes: t.array(TRegex),
excluded_channels: t.array(t.string),
excluded_categories: t.array(t.string),
exclude_bots: t.boolean,
format: tNullable(tLogFormats),
timestamp_format: t.string,
include_embed_timestamp: t.boolean,

View file

@ -27,6 +27,15 @@ export async function log(pluginData: GuildPluginData<LogsPluginType>, type: Log
}
}
// If we're excluding bots and the logged user is a bot, skip it
if (opts.exclude_bots) {
for (const prop of excludedUserProps) {
if (data && data[prop] && data[prop].bot) {
continue logChannelLoop;
}
}
}
// If this entry is from an excluded channel, skip it
if (opts.excluded_channels) {
if (