From 8d9b934feec5fc820e05e984abb91e0a0306ecf9 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 5 Oct 2023 13:56:31 -0400 Subject: [PATCH] fix(moderation): fixed handle_expiry task --- moderation/moderation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/moderation/moderation.py b/moderation/moderation.py index 6b333cf..b0b497a 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -408,8 +408,11 @@ class Moderation(commands.Cog): return database = await self.connect() cursor = database.cursor() - query = f"UPDATE {await self.config.mysql_database()}.* SET expired = 1 WHERE end_timestamp <= %s AND expired = 0" - cursor.execute(query, (time.time(),)) + db = await self.config.mysql_database() + guilds: list[discord.Guild] = self.bot.guilds + for guild in guilds: + query = f"UPDATE `{db}`.`moderation_{guild.id}` SET expired = 1 WHERE end_timestamp <= %s AND expired = 0" + cursor.execute(query, (time.time(),)) database.commit() cursor.close() database.close()