Compare commits

..

No commits in common. "008d4b8d57aa2a63175980a756bc009cf4298360" and "d580331b31d942b0fb4a0faded5b95bb2f0464a9" have entirely different histories.

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