3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-12 21:05:02 +00:00

feat(automod): add affects_self option for rules

This commit is contained in:
Dragory 2021-10-17 08:15:30 +03:00
parent 1f4f27c26a
commit 151a5df4af
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 6 additions and 5 deletions

View file

@ -23,11 +23,6 @@ export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>,
const channel = channelOrThread?.isThread() ? channelOrThread.parent : channelOrThread;
const categoryId = channel?.parentId;
// Don't apply Automod on Zeppelin itself
if (userId && userId === pluginData.client.user?.id) {
return;
}
const config = await pluginData.config.getMatchingConfig({
channelId,
categoryId,
@ -39,6 +34,7 @@ export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>,
for (const [ruleName, rule] of Object.entries(config.rules)) {
if (rule.enabled === false) continue;
if (!rule.affects_bots && (!user || user.bot) && !context.counterTrigger && !context.antiraid) continue;
if (!rule.affects_self && userId && userId === pluginData.client.user?.id) continue;
if (rule.cooldown && checkAndUpdateCooldown(pluginData, rule, context)) {
continue;