fix(moderation): you can no longer unban someone who is not banned
All checks were successful
Pylint / Pylint (push) Successful in 1m12s
All checks were successful
Pylint / Pylint (push) Successful in 1m12s
This commit is contained in:
parent
45a5354299
commit
008d4b8d57
1 changed files with 5 additions and 0 deletions
|
@ -332,6 +332,11 @@ class Moderation(commands.Cog):
|
||||||
@app_commands.command(name="unban")
|
@app_commands.command(name="unban")
|
||||||
async def unban(self, interaction: discord.Interaction, target: discord.User, reason: str = None):
|
async def unban(self, interaction: discord.Interaction, target: discord.User, reason: str = None):
|
||||||
"""Unban a user."""
|
"""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:
|
if reason:
|
||||||
await interaction.guild.unban(target.id, reason=f"Unbanned by {interaction.user.id} for: {reason}")
|
await interaction.guild.unban(target.id, reason=f"Unbanned by {interaction.user.id} for: {reason}")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue