fix(aurora): hopefully fixed a pydantic validation error
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 26s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 39s

This commit is contained in:
Seaswimmer 2024-05-24 03:57:54 -04:00
parent 599ab8c51d
commit 0b1d1d29e6
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -177,6 +177,9 @@ class Moderation(AuroraGuildModel):
for change in changes: for change in changes:
change_obj_list.append(Change.from_dict(bot=bot, data=change)) change_obj_list.append(Change.from_dict(bot=bot, data=change))
if result[15] is not None:
metadata = json.loads(result[15])
case = { case = {
"moderation_id": int(result[0]), "moderation_id": int(result[0]),
"guild_id": int(guild_id), "guild_id": int(guild_id),
@ -194,7 +197,7 @@ class Moderation(AuroraGuildModel):
"resolve_reason": result[12], "resolve_reason": result[12],
"expired": bool(result[13]), "expired": bool(result[13]),
"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": metadata if result[15] else {},
} }
return cls.from_dict(bot=bot, data=case) return cls.from_dict(bot=bot, data=case)