Compare commits

...

2 commits

Author SHA1 Message Date
008d4b8d57
fix(moderation): you can no longer unban someone who is not banned
All checks were successful
Pylint / Pylint (push) Successful in 1m12s
2023-10-05 11:17:41 -04:00
45a5354299
fix(moderation): fixed fetch_ban on line 303 2023-10-05 11:16:21 -04:00

View file

@ -300,7 +300,7 @@ class Moderation(commands.Cog):
async def ban(self, interaction: discord.Interaction, target: discord.User, reason: str, duration: str = None, delete_messages: Choice[int] = 0):
"""Ban a user."""
try:
await interaction.guild.fetch_ban(target.id)
await interaction.guild.fetch_ban(target)
await interaction.response.send_message(content=f"{target.mention} is already banned!", ephemeral=True)
return
except discord.errors.NotFound:
@ -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: