fix(aurora): fixed the json issue from yesterday

This commit is contained in:
Seaswimmer 2024-05-06 13:27:09 -04:00
parent 4c8cd7bd16
commit 85a935f9b3
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -1,5 +1,6 @@
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
import json import json
from ast import literal_eval
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing import Optional, Union from typing import Optional, Union
@ -11,7 +12,6 @@ from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import error from redbot.core.utils.chat_formatting import error
from aurora.utilities.config import config from aurora.utilities.config import config
from aurora.utilities.logger import logger
def check_permissions( def check_permissions(
@ -135,9 +135,7 @@ def generate_dict(bot: Red, result: dict, guild_id: int) -> dict:
duration = None duration = None
if result[14] is not None: if result[14] is not None:
json_str = result[14].replace('\\"', '"').replace('["{', '[{').replace('}"]', '}]') changes = literal_eval(json.loads(result[14]))
logger.debug('%s\n%s', result[14], json_str)
changes = json.loads(json_str)
change_obj_list = [] change_obj_list = []
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))