diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-12 21:20:42 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-12 21:20:42 -0400 |
commit | f627669089b7e3a79086c92775bacc88681646b4 (patch) | |
tree | 1fcc7e9ba2bc878ff49bc15d49709bb6c743e40e /src | |
parent | bce2228113cc7088357933dee485a876d898d550 (diff) | |
download | tanzanite-f627669089b7e3a79086c92775bacc88681646b4.tar.gz tanzanite-f627669089b7e3a79086c92775bacc88681646b4.tar.bz2 tanzanite-f627669089b7e3a79086c92775bacc88681646b4.zip |
add permissionCheck to ban button
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/common/autoMod.ts | 15 |
1 files changed, 15 insertions, 0 deletions
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') |