diff --git a/moderation/moderation.py b/moderation/moderation.py index a37186a..34d4f3a 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -398,8 +398,12 @@ class Moderation(commands.Cog): @app_commands.command(name="resolve") async def resolve(self, interaction: discord.Interaction, case_number: int, reason: str = None): """Resolve a specific case.""" + conf = await self.check_conf(['mysql_database']) + if conf: + raise(LookupError) database = await self.connect() cursor = database.cursor() + db = await self.config.mysql_database() query_1 = "SELECT * FROM moderation_%s WHERE moderation_id = %s;" cursor.execute(query_1, (interaction.guild.id, case_number)) 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}") except discord.NotFound: 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: - 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)) await interaction.response.send_message(content=f"✅ Moderation #{case_number} resolved!")