From f627669089b7e3a79086c92775bacc88681646b4 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 12 Oct 2021 21:20:42 -0400 Subject: add permissionCheck to ban button --- src/lib/common/autoMod.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/lib/common/autoMod.ts') diff --git a/src/lib/common/autoMod.ts b/src/lib/common/autoMod.ts index 10bccba..66ff5ed 100644 --- a/src/lib/common/autoMod.ts +++ b/src/lib/common/autoMod.ts @@ -3,7 +3,9 @@ import badLinksArray from '../../lib/badlinks'; import badLinksSecretArray from '../../lib/badlinks-secret'; // I cannot make this public so just make a new file that export defaults an empty array import badWords from '../../lib/badwords'; import { BushButtonInteraction } from '../extensions/discord.js/BushButtonInteraction'; +import { BushGuildMember } from '../extensions/discord.js/BushGuildMember'; import { BushMessage } from '../extensions/discord.js/BushMessage'; +import { Moderation } from './moderation'; export class AutoMod { private message: BushMessage; @@ -192,6 +194,19 @@ export class AutoMod { switch (action) { case 'ban': { await interaction.deferReply(); + const check = await Moderation.permissionCheck( + interaction.member as BushGuildMember, + interaction.guild!.members.cache.get(userId)!, + 'ban', + true + ); + + if (check !== true) + return interaction.reply({ + content: check, + ephemeral: true + }); + const result = await interaction.guild?.bushBan({ user: userId, reason, moderator: interaction.user.id }); if (result === 'success') -- cgit