WIP: Refactor Aurora (3.0.0) #29
2 changed files with 3 additions and 3 deletions
|
@ -1614,7 +1614,7 @@ class Aurora(commands.Cog):
|
|||
continue
|
||||
|
||||
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);"
|
||||
await Moderation.execute(bot=self.bot, guild_id=guild.id, query=expiry_query, parameters=(time.time(),))
|
||||
await Moderation.execute(bot=self.bot, guild_id=guild.id, query=expiry_query, parameters=(time.time(),), return_obj=False)
|
||||
|
||||
per_guild_completion_time = (time.time() - time_per_guild) * 1000
|
||||
logger.debug(
|
||||
|
|
|
@ -208,7 +208,7 @@ class Moderation(AuroraGuildModel):
|
|||
return cls.from_dict(bot=bot, data=case)
|
||||
|
||||
@classmethod
|
||||
async def execute(cls, bot: Red, guild_id: int, query: str, parameters: tuple | None = None, cursor: Cursor | None = None) -> Tuple["Moderation"]:
|
||||
async def execute(cls, bot: Red, guild_id: int, query: str, parameters: tuple | None = None, cursor: Cursor | None = None, return_obj: bool = True) -> Tuple["Moderation"]:
|
||||
from ..utilities.database import connect
|
||||
logger.trace("Executing query: %s", query)
|
||||
logger.trace("With parameters: %s", parameters)
|
||||
|
@ -227,7 +227,7 @@ class Moderation(AuroraGuildModel):
|
|||
await cursor.close()
|
||||
await database.close()
|
||||
|
||||
if results:
|
||||
if results and return_obj:
|
||||
cases = []
|
||||
for result in results:
|
||||
case = cls.from_result(bot=bot, result=result, guild_id=guild_id)
|
||||
|
|
Loading…
Reference in a new issue