fix(aurora): fixed a faulty expiration check
This commit is contained in:
parent
a3a208b38e
commit
2c336ff70c
1 changed files with 4 additions and 4 deletions
|
@ -1621,7 +1621,7 @@ class Aurora(commands.Cog):
|
||||||
if not await self.bot.cog_disabled_in_guild(self, guild):
|
if not await self.bot.cog_disabled_in_guild(self, guild):
|
||||||
time_per_guild = time.time()
|
time_per_guild = time.time()
|
||||||
|
|
||||||
tempban_query = f"SELECT target_id, moderation_id FROM moderation_{guild.id} WHERE end_timestamp != 0 AND end_timestamp <= ? AND moderation_type = 'TEMPBAN' AND expired = 0"
|
tempban_query = f"SELECT target_id, moderation_id FROM moderation_{guild.id} WHERE end_timestamp IS NOT NULL 0 AND end_timestamp <= ? AND moderation_type = 'TEMPBAN' AND expired = 0"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cursor.execute(tempban_query, (time.time(),))
|
cursor.execute(tempban_query, (time.time(),))
|
||||||
|
@ -1680,7 +1680,7 @@ class Aurora(commands.Cog):
|
||||||
)
|
)
|
||||||
|
|
||||||
removerole_num = 0
|
removerole_num = 0
|
||||||
addrole_query = f"SELECT target_id, moderation_id, role_id FROM moderation_{guild.id} WHERE end_timestamp != 0 AND end_timestamp <= ? AND moderation_type = 'ADDROLE' AND expired = 0"
|
addrole_query = f"SELECT target_id, moderation_id, role_id FROM moderation_{guild.id} WHERE end_timestamp IS NOT NULL AND end_timestamp <= ? AND moderation_type = 'ADDROLE' AND expired = 0"
|
||||||
try:
|
try:
|
||||||
cursor.execute(addrole_query, (time.time(),))
|
cursor.execute(addrole_query, (time.time(),))
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
|
@ -1715,7 +1715,7 @@ class Aurora(commands.Cog):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
addrole_num = 0
|
addrole_num = 0
|
||||||
removerole_query = f"SELECT target_id, moderation_id, role_id FROM moderation_{guild.id} WHERE end_timestamp != 0 AND end_timestamp <= ? AND moderation_type = 'REMOVEROLE' AND expired = 0"
|
removerole_query = f"SELECT target_id, moderation_id, role_id FROM moderation_{guild.id} WHERE end_timestamp IS NOT NULL 0 AND end_timestamp <= ? AND moderation_type = 'REMOVEROLE' AND expired = 0"
|
||||||
try:
|
try:
|
||||||
cursor.execute(removerole_query, (time.time(),))
|
cursor.execute(removerole_query, (time.time(),))
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
|
@ -1744,7 +1744,7 @@ class Aurora(commands.Cog):
|
||||||
logger.error("Adding the role %s to user %s failed due to: \n%s", role_id, target_id, e)
|
logger.error("Adding the role %s to user %s failed due to: \n%s", role_id, target_id, e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
expiry_query = f"UPDATE `moderation_{guild.id}` SET expired = 1 WHERE (end_timestamp != 0 AND end_timestamp <= ? AND expired = 0) OR (expired = 0 AND resolved = 1);"
|
expiry_query = f"UPDATE `moderation_{guild.id}` SET expired = 1 WHERE (end_timestamp IS NOT NULL AND end_timestamp <= ? AND expired = 0) OR (expired = 0 AND resolved = 1);"
|
||||||
cursor.execute(expiry_query, (time.time(),))
|
cursor.execute(expiry_query, (time.time(),))
|
||||||
|
|
||||||
per_guild_completion_time = (time.time() - time_per_guild) * 1000
|
per_guild_completion_time = (time.time() - time_per_guild) * 1000
|
||||||
|
|
Loading…
Reference in a new issue