fix(moderation): using target object instead of target.id for ban command and unban command
All checks were successful
Pylint / Pylint (push) Successful in 1m12s

This commit is contained in:
Seaswimmer 2023-10-05 11:22:35 -04:00
parent 008d4b8d57
commit 2982b475ca
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -326,7 +326,7 @@ class Moderation(commands.Cog):
await target.send(embed=embed) await target.send(embed=embed)
except discord.errors.HTTPException: except discord.errors.HTTPException:
pass pass
await interaction.guild.ban(target.id, reason=f"Banned by {interaction.user.id} for: {reason}", delete_message_seconds=delete_messages) await interaction.guild.ban(target, reason=f"Banned by {interaction.user.id} for: {reason}", delete_message_seconds=delete_messages)
await self.mysql_log(interaction.guild.id, interaction.user.id, 'BAN', target.id, 'NULL', reason) await self.mysql_log(interaction.guild.id, interaction.user.id, 'BAN', target.id, 'NULL', reason)
@app_commands.command(name="unban") @app_commands.command(name="unban")
@ -338,9 +338,9 @@ class Moderation(commands.Cog):
await interaction.response.send_message(content=f"{target.mention} is not banned!", ephemeral=True) await interaction.response.send_message(content=f"{target.mention} is not banned!", ephemeral=True)
return 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, reason=f"Unbanned by {interaction.user.id} for: {reason}")
else: else:
await interaction.guild.unban(target.id, reason=f"Unbanned by {interaction.user.id}") await interaction.guild.unban(target, reason=f"Unbanned by {interaction.user.id}")
reason = "No reason given." reason = "No reason given."
await interaction.response.send_message(content=f"{target.mention} has been unbanned!\n**Reason** - `{reason}`") await interaction.response.send_message(content=f"{target.mention} has been unbanned!\n**Reason** - `{reason}`")
try: try: