From 722f0a53f15f44fd7a63f2686d53dde67bb83c50 Mon Sep 17 00:00:00 2001 From: smyalygames Date: Fri, 28 Oct 2022 02:38:58 +0100 Subject: [PATCH] fix(arabot): add catch if user is not banned --- src/commands/mod/unban.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts index 0a0e59d..7c68638 100644 --- a/src/commands/mod/unban.ts +++ b/src/commands/mod/unban.ts @@ -65,7 +65,16 @@ class UnbanCommand extends Command { } // Unban the user - await guild.members.unban(user); + try { + await guild.members.unban(user); + } catch { + await interaction.reply({ + content: `${user} is not banned.`, + ephemeral: true, + fetchReply: true, + }); + return; + } await interaction.reply({ content: `${user} has been unbanned.`, @@ -119,7 +128,15 @@ class UnbanCommand extends Command { } // Unban the user - await guild.members.unban(user); + try { + await guild.members.unban(user); + } catch { + await message.react('❌'); + await message.reply({ + content: `${user} is not banned.`, + }); + return; + } await message.react('✅');