WIP: Refactor Aurora (3.0.0) #29
1 changed files with 5 additions and 5 deletions
|
@ -230,14 +230,14 @@ class Moderation(AuroraGuildModel):
|
|||
|
||||
@classmethod
|
||||
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 = [offset]
|
||||
query = f"SELECT * FROM moderation_{guild_id} ORDER BY moderation_id DESC OFFSET ?"
|
||||
if limit:
|
||||
query += " LIMIT ?"
|
||||
params.append(limit)
|
||||
params = []
|
||||
query = f"SELECT * FROM moderation_{guild_id} ORDER BY moderation_id DESC"
|
||||
if types:
|
||||
query += f" WHERE moderation_type IN ({', '.join(['?' for _ in types])})"
|
||||
params.extend(types)
|
||||
if limit:
|
||||
query += " LIMIT ? OFFSET ?"
|
||||
params.extend((limit, offset))
|
||||
query += ";"
|
||||
return cls.execute(bot=bot, guild_id=guild_id, query=query, parameters=tuple(params) if params else (), cursor=cursor)
|
||||
|
||||
|
|
Loading…
Reference in a new issue