aboutsummaryrefslogtreecommitdiff
path: root/src/lib/common
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-15 18:09:56 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-15 18:09:56 -0500
commit979170bafab1444353fc330627d8bfd0d8b68aff (patch)
treec0acc15a7bd0ee1659d01e08632076622ef41430 /src/lib/common
parent8ef5ea8282ba210ec04fecae1de1b9b7cb48452b (diff)
downloadtanzanite-979170bafab1444353fc330627d8bfd0d8b68aff.tar.gz
tanzanite-979170bafab1444353fc330627d8bfd0d8b68aff.tar.bz2
tanzanite-979170bafab1444353fc330627d8bfd0d8b68aff.zip
add a case for dm failure for automod button ban
Diffstat (limited to 'src/lib/common')
-rw-r--r--src/lib/common/AutoMod.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts
index 50f5d3e..a1f2f1e 100644
--- a/src/lib/common/AutoMod.ts
+++ b/src/lib/common/AutoMod.ts
@@ -1,4 +1,4 @@
-import { Moderation, type BushButtonInteraction, type BushMessage } from '#lib';
+import { banResponse, Moderation, type BushButtonInteraction, type BushMessage } from '#lib';
import { GuildMember, MessageActionRow, MessageButton, MessageEmbed, type TextChannel } from 'discord.js';
/**
@@ -308,18 +308,20 @@ export class AutoMod {
evidence: (interaction.message as BushMessage).url ?? undefined
});
- if (result === 'success')
+ const victimFormatted = victim ?? userId;
+ if (result === banResponse.SUCCESS)
return interaction.reply({
- content: `${util.emojis.success} Successfully banned **${
- interaction.guild?.members.cache.get(userId)?.user.tag ?? userId
- }**.`,
+ content: `${util.emojis.success} Successfully banned **${victimFormatted}**.`,
+ ephemeral: true
+ });
+ else if (result === banResponse.DM_ERROR)
+ return interaction.reply({
+ content: `${util.emojis.warn} Banned ${victimFormatted} however I could not send them a dm.`,
ephemeral: true
});
else
return interaction.reply({
- content: `${util.emojis.error} Could not ban **${
- interaction.guild?.members.cache.get(userId)?.user.tag ?? userId
- }**: \`${result}\` .`,
+ content: `${util.emojis.error} Could not ban **${victimFormatted}**: \`${result}\` .`,
ephemeral: true
});
}