WIP: Refactor Aurora (3.0.0) #29
1 changed files with 4 additions and 4 deletions
|
@ -229,9 +229,9 @@ class Moderation(AuroraGuildModel):
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_latest(cls, bot: Red, guild_id: int, limit: int | None = None, types: Iterable | None = None, cursor: Cursor | None = None) -> Tuple["Moderation"]:
|
def get_latest(cls, bot: Red, guild_id: int, limit: int | None = None, offset: int = 0, types: Iterable | None = None, cursor: Cursor | None = None) -> Tuple["Moderation"]:
|
||||||
params = []
|
params = [offset]
|
||||||
query = f"SELECT * FROM moderation_{guild_id} ORDER BY moderation_id DESC"
|
query = f"SELECT * FROM moderation_{guild_id} ORDER BY moderation_id DESC OFFSET ?"
|
||||||
if limit:
|
if limit:
|
||||||
query += " LIMIT ?"
|
query += " LIMIT ?"
|
||||||
params.append(limit)
|
params.append(limit)
|
||||||
|
@ -239,7 +239,7 @@ class Moderation(AuroraGuildModel):
|
||||||
query += f" WHERE moderation_type IN ({', '.join(['?' for _ in types])})"
|
query += f" WHERE moderation_type IN ({', '.join(['?' for _ in types])})"
|
||||||
params.extend(types)
|
params.extend(types)
|
||||||
query += ";"
|
query += ";"
|
||||||
return cls.execute(bot=bot, guild_id=guild_id, query=query, parameters=tuple(params) if limit else (), cursor=cursor)
|
return cls.execute(bot=bot, guild_id=guild_id, query=query, parameters=tuple(params) if params else (), cursor=cursor)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_next_case_number(cls, bot: Red, guild_id: int, cursor: Cursor | None = None) -> int:
|
def get_next_case_number(cls, bot: Red, guild_id: int, cursor: Cursor | None = None) -> int:
|
||||||
|
|
Loading…
Reference in a new issue