From 008d4b8d57aa2a63175980a756bc009cf4298360 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 5 Oct 2023 11:17:41 -0400 Subject: [PATCH] fix(moderation): you can no longer unban someone who is not banned --- moderation/moderation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/moderation/moderation.py b/moderation/moderation.py index dd6633b..935794c 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -332,6 +332,11 @@ class Moderation(commands.Cog): @app_commands.command(name="unban") async def unban(self, interaction: discord.Interaction, target: discord.User, reason: str = None): """Unban a user.""" + try: + await interaction.guild.fetch_ban(target) + except discord.errors.NotFound: + await interaction.response.send_message(content=f"{target.mention} is not banned!", ephemeral=True) + return if reason: await interaction.guild.unban(target.id, reason=f"Unbanned by {interaction.user.id} for: {reason}") else: