From 38180f5ccdb986a147a29708198cd7479ee4f12d Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Tue, 4 Jun 2024 12:29:24 -0400 Subject: [PATCH] fix(aurora): fixed an sql operation error --- aurora/models/moderation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aurora/models/moderation.py b/aurora/models/moderation.py index bb36a90..53ad512 100644 --- a/aurora/models/moderation.py +++ b/aurora/models/moderation.py @@ -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)