fix(aurora): fixed another TypeError
This commit is contained in:
parent
028e22ebec
commit
99d95afe07
1 changed files with 6 additions and 6 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue