fix(moderation): fixed error in handle_expiry if a table doesn't exist yet
All checks were successful
Pylint / Pylint (push) Successful in 1m11s
All checks were successful
Pylint / Pylint (push) Successful in 1m11s
This commit is contained in:
parent
8a3ed15ee0
commit
da469e7d35
1 changed files with 5 additions and 2 deletions
|
@ -523,8 +523,11 @@ class Moderation(commands.Cog):
|
||||||
guilds: list[discord.Guild] = self.bot.guilds
|
guilds: list[discord.Guild] = self.bot.guilds
|
||||||
for guild in 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"
|
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"
|
||||||
cursor.execute(tempban_query, (time.time(),))
|
try:
|
||||||
result = cursor.fetchall()
|
cursor.execute(tempban_query, (time.time(),))
|
||||||
|
result = cursor.fetchall()
|
||||||
|
except mysql.connector.errors.ProgrammingError:
|
||||||
|
continue
|
||||||
target_ids = [row[0] for row in result]
|
target_ids = [row[0] for row in result]
|
||||||
moderation_ids = [row[1] for row in result]
|
moderation_ids = [row[1] for row in result]
|
||||||
for target_id, moderation_id in zip(target_ids, moderation_ids):
|
for target_id, moderation_id in zip(target_ids, moderation_ids):
|
||||||
|
|
Loading…
Reference in a new issue