mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-11-24 21:05:39 +01:00
triggers/pingBomb: exclude moderators from the auto-ban
This commit is contained in:
parent
4f8bf4574f
commit
718d5d54f0
@ -3,13 +3,20 @@ import state from '../state';
|
|||||||
import logger from '../logging';
|
import logger from '../logging';
|
||||||
import * as discord from 'discord.js';
|
import * as discord from 'discord.js';
|
||||||
|
|
||||||
|
const ExemptRoles = ['Administrators', 'Moderators', 'Team', 'Developer', 'Support', 'VIP'];
|
||||||
|
|
||||||
export function trigger (message: discord.Message) {
|
export function trigger (message: discord.Message) {
|
||||||
return message.mentions.users.size > 10;
|
return message.mentions.users.size > 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function execute (message: discord.Message) {
|
export async function execute (message: discord.Message) {
|
||||||
const count = message.mentions.users.size;
|
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()}`);
|
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 state.logChannel?.send(`Ping bomb detected in ${message.channel.toString()} by ${message.author.toString()}`);
|
||||||
|
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);
|
await ban(message.author, message.author, message.guild);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user