WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
2 changed files with 4 additions and 1 deletions
Showing only changes of commit ac7d950aaa - Show all commits

View file

@ -46,7 +46,7 @@ class Aurora(commands.Cog):
This cog stores all of its data in an SQLite database.""" This cog stores all of its data in an SQLite database."""
__author__ = ["Seaswimmer"] __author__ = ["Seaswimmer"]
__version__ = "3.0.0-indev19" __version__ = "3.0.0-indev20"
__documentation__ = "https://seacogs.coastalcommits.com/aurora/" __documentation__ = "https://seacogs.coastalcommits.com/aurora/"
async def red_delete_data_for_user(self, *, requester, user_id: int): async def red_delete_data_for_user(self, *, requester, user_id: int):

View file

@ -4,6 +4,7 @@ from typing import Literal, Optional
from redbot.core.bot import Red from redbot.core.bot import Red
from ..utilities.logger import logger
from ..utilities.utils import timedelta_from_string from ..utilities.utils import timedelta_from_string
from .base import AuroraBaseModel from .base import AuroraBaseModel
from .partials import PartialUser from .partials import PartialUser
@ -31,6 +32,8 @@ class Change(AuroraBaseModel):
def from_dict(cls, bot: Red, data: dict) -> "Change": def from_dict(cls, bot: Red, data: dict) -> "Change":
if isinstance(data, str): if isinstance(data, str):
data = json.loads(data) data = json.loads(data)
if data.get('duration'):
logger.debug(f"Duration: {data['duration']}")
if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta) and not data["duration"] == "NULL": if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta) and not data["duration"] == "NULL":
duration = timedelta_from_string(data["duration"]) duration = timedelta_from_string(data["duration"])
elif "duration" in data and isinstance(data["duration"], timedelta): elif "duration" in data and isinstance(data["duration"], timedelta):