fix(aurora): make Moderration.from_result() return a Moderation object instead of a dictionary
This commit is contained in:
parent
c2e017339e
commit
bb5ab8e61b
1 changed files with 2 additions and 2 deletions
|
@ -179,7 +179,7 @@ class Moderation(AuroraGuildModel):
|
||||||
return cls(bot=bot, **data)
|
return cls(bot=bot, **data)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_result(cls, bot: Red, result: Iterable, guild_id: int) -> dict:
|
def from_result(cls, bot: Red, result: Iterable, guild_id: int) -> "Moderation":
|
||||||
if result[7] is not None:
|
if result[7] is not None:
|
||||||
hours, minutes, seconds = map(int, result[7].split(':'))
|
hours, minutes, seconds = map(int, result[7].split(':'))
|
||||||
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
||||||
|
@ -211,7 +211,7 @@ class Moderation(AuroraGuildModel):
|
||||||
"changes": change_obj_list if result[14] else [],
|
"changes": change_obj_list if result[14] else [],
|
||||||
"metadata": json.loads(result[15].replace('\\"', '"').replace('["{', '[{').replace('}"]', '}]')) if result[15] else {},
|
"metadata": json.loads(result[15].replace('\\"', '"').replace('["{', '[{').replace('}"]', '}]')) if result[15] else {},
|
||||||
}
|
}
|
||||||
return case
|
return cls.from_dict(bot=bot, data=case)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_sql(cls, bot: Red, moderation_id: int, guild_id: int) -> "Moderation":
|
def from_sql(cls, bot: Red, moderation_id: int, guild_id: int) -> "Moderation":
|
||||||
|
|
Loading…
Reference in a new issue