WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
Showing only changes of commit 0d64e3f652 - Show all commits

View file

@ -4,6 +4,7 @@ from typing import Literal, Optional
from redbot.core.bot import Red
from ..utilities.utils import timedelta_from_string
from .base import AuroraBaseModel
from .partials import PartialUser
@ -31,8 +32,7 @@ class Change(AuroraBaseModel):
if isinstance(data, str):
data = json.loads(data)
if "duration" in data and data["duration"] and not isinstance(data["duration"], timedelta) and not data["duration"] == "NULL":
hours, minutes, seconds = map(int, data["duration"].split(':'))
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
duration = timedelta_from_string(data["duration"])
elif "duration" in data and isinstance(data["duration"], timedelta):
duration = data["duration"]
else: