From 718d5d54f0f36118d38f6cdbe0943e5d92be820d Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sat, 31 Dec 2022 02:03:10 -0700 Subject: [PATCH] triggers/pingBomb: exclude moderators from the auto-ban --- src/triggers/pingBomb.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/triggers/pingBomb.ts b/src/triggers/pingBomb.ts index 8d29e8e..5789595 100644 --- a/src/triggers/pingBomb.ts +++ b/src/triggers/pingBomb.ts @@ -3,13 +3,20 @@ import state from '../state'; import logger from '../logging'; import * as discord from 'discord.js'; +const ExemptRoles = ['Administrators', 'Moderators', 'Team', 'Developer', 'Support', 'VIP']; + export function trigger (message: discord.Message) { return message.mentions.users.size > 10; } export async function execute (message: discord.Message) { const count = message.mentions.users.size; + const exempt = message.member?.roles?.cache.find(role => ExemptRoles.includes(role.name)) !== undefined; logger.info(`${message.author.toString()} tagged ${count} users in ${message.channel.toString()}`); await state.logChannel?.send(`Ping bomb detected in ${message.channel.toString()} by ${message.author.toString()}`); - await ban(message.author, message.author, message.guild); + if (exempt) { + await state.logChannel?.send(`... however ${message.author.toString()} is exempt from the banning rule.`); + } else { + await ban(message.author, message.author, message.guild); + } }