fix(moderation): you can no longer unban someone who is not banned
All checks were successful
Pylint / Pylint (push) Successful in 1m12s

This commit is contained in:
Seaswimmer 2023-10-05 11:17:41 -04:00
parent 45a5354299
commit 008d4b8d57
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -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: