fix(moderation): fixed resolve command
All checks were successful
Pylint / Pylint (push) Successful in 1m13s
All checks were successful
Pylint / Pylint (push) Successful in 1m13s
This commit is contained in:
parent
5fa62fceca
commit
fedd5f6799
1 changed files with 6 additions and 2 deletions
|
@ -398,8 +398,12 @@ class Moderation(commands.Cog):
|
||||||
@app_commands.command(name="resolve")
|
@app_commands.command(name="resolve")
|
||||||
async def resolve(self, interaction: discord.Interaction, case_number: int, reason: str = None):
|
async def resolve(self, interaction: discord.Interaction, case_number: int, reason: str = None):
|
||||||
"""Resolve a specific case."""
|
"""Resolve a specific case."""
|
||||||
|
conf = await self.check_conf(['mysql_database'])
|
||||||
|
if conf:
|
||||||
|
raise(LookupError)
|
||||||
database = await self.connect()
|
database = await self.connect()
|
||||||
cursor = database.cursor()
|
cursor = database.cursor()
|
||||||
|
db = await self.config.mysql_database()
|
||||||
query_1 = "SELECT * FROM moderation_%s WHERE moderation_id = %s;"
|
query_1 = "SELECT * FROM moderation_%s WHERE moderation_id = %s;"
|
||||||
cursor.execute(query_1, (interaction.guild.id, case_number))
|
cursor.execute(query_1, (interaction.guild.id, case_number))
|
||||||
result_1 = cursor.fetchone()
|
result_1 = cursor.fetchone()
|
||||||
|
@ -428,9 +432,9 @@ class Moderation(commands.Cog):
|
||||||
await interaction.guild.unban(user, reason=f"Case #{case_number} resolved by {interaction.user.id}")
|
await interaction.guild.unban(user, reason=f"Case #{case_number} resolved by {interaction.user.id}")
|
||||||
except discord.NotFound:
|
except discord.NotFound:
|
||||||
pass
|
pass
|
||||||
resolve_query = f"UPDATE moderation_{interaction.guild.id} SET resolved = 1, expired = 1, resolve_reason = %s WHERE moderation_id = %s"
|
resolve_query = f"UPDATE `{db}`.`moderation_{interaction.guild.id}` SET resolved = 1, expired = 1, resolve_reason = %s WHERE moderation_id = %s"
|
||||||
else:
|
else:
|
||||||
resolve_query = f"UPDATE moderation_{interaction.guild.id} SET resolved = 1, resolve_reason = %s WHERE moderation_id = %s"
|
resolve_query = f"UPDATE `{db}`.`moderation_{interaction.guild.id}` SET resolved = 1, resolve_reason = %s WHERE moderation_id = %s"
|
||||||
cursor.execute(resolve_query, (reason, case_number))
|
cursor.execute(resolve_query, (reason, case_number))
|
||||||
await interaction.response.send_message(content=f"✅ Moderation #{case_number} resolved!")
|
await interaction.response.send_message(content=f"✅ Moderation #{case_number} resolved!")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue