fix(moderation): fixed error in handle_expiry if a table doesn't exist yet
All checks were successful
Pylint / Pylint (push) Successful in 1m11s

This commit is contained in:
Seaswimmer 2023-10-06 10:18:55 -04:00
parent 8a3ed15ee0
commit da469e7d35
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -523,8 +523,11 @@ class Moderation(commands.Cog):
guilds: list[discord.Guild] = self.bot.guilds
for guild in guilds:
tempban_query = f"SELECT target_id, moderation_id FROM moderation_{guild.id} WHERE end_timestamp != 0 AND end_timestamp <= %s AND moderation_type = 'TEMPBAN' AND expired = 0"
try:
cursor.execute(tempban_query, (time.time(),))
result = cursor.fetchall()
except mysql.connector.errors.ProgrammingError:
continue
target_ids = [row[0] for row in result]
moderation_ids = [row[1] for row in result]
for target_id, moderation_id in zip(target_ids, moderation_ids):