From 99d95afe07d5c8f02fd2b20135ea3289f690c4f0 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Mon, 3 Jun 2024 00:51:51 -0400 Subject: [PATCH] fix(aurora): fixed another TypeError --- aurora/models/moderation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aurora/models/moderation.py b/aurora/models/moderation.py index 17d4e13..17a48f5 100644 --- a/aurora/models/moderation.py +++ b/aurora/models/moderation.py @@ -202,7 +202,7 @@ class Moderation(AuroraGuildModel): return cls.from_dict(bot=bot, data=case) @classmethod - def execute(cls, bot: Red, query: str, parameters: tuple | None = None) -> List["Moderation"]: + def execute(cls, bot: Red, guild_id: int, query: str, parameters: tuple | None = None) -> List["Moderation"]: from ..utilities.database import connect if not parameters: parameters = () @@ -215,7 +215,7 @@ class Moderation(AuroraGuildModel): if results: cases = [] for result in results: - case = cls.from_result(bot=bot, result=result) + case = cls.from_result(bot=bot, result=result, guild_id=guild_id) if case.moderation_id != 0: cases.append(case) return cases @@ -228,7 +228,7 @@ class Moderation(AuroraGuildModel): @classmethod def find_by_id(cls, bot: Red, moderation_id: int, guild_id: int) -> "Moderation": query = f"SELECT * FROM moderation_{guild_id} WHERE moderation_id = ?;" - case = cls.execute(bot=bot, query=query, parameters=(moderation_id,)) + case = cls.execute(bot=bot, guild_id=guild_id, query=query, parameters=(moderation_id,)) if case: return case[0] raise ValueError(f"Case {moderation_id} not found in moderation_{guild_id}!") @@ -240,7 +240,7 @@ class Moderation(AuroraGuildModel): query += f" AND moderation_type IN ({', '.join(['?' for _ in types])})" query += " ORDER BY moderation_id DESC;" - return cls.execute(bot=bot, query=query, parameters=(target, *types) if types else (target,)) + return cls.execute(bot=bot, guild_id=guild_id, query=query, parameters=(target, *types) if types else (target,)) @classmethod def find_by_moderator(cls, bot: Red, guild_id: int, moderator: int, types: list | None = None) -> List["Moderation"]: @@ -249,7 +249,7 @@ class Moderation(AuroraGuildModel): query += f" AND moderation_type IN ({', '.join(['?' for _ in types])})" query += " ORDER BY moderation_id DESC;" - return cls.execute(bot=bot, query=query, parameters=(moderator, *types) if types else (moderator,)) + return cls.execute(bot=bot, guild_id=guild_id, query=query, parameters=(moderator, *types) if types else (moderator,)) @classmethod def get_all_cases(cls, bot: Red, guild_id: int, types: list | None = None) -> List["Moderation"]: @@ -257,7 +257,7 @@ class Moderation(AuroraGuildModel): if types: query += f" WHERE moderation_type IN ({', '.join(['?' for _ in types])})" query += " ORDER BY moderation_id DESC;" - return cls.execute(bot=bot, query=query, parameters=tuple(iterable=types) if types else None) + return cls.execute(bot=bot, guild_id=guild_id, query=query, parameters=tuple(iterable=types) if types else None) @classmethod def log(