WIP: Refactor Aurora (3.0.0) #29
1 changed files with 2 additions and 2 deletions
|
@ -4,6 +4,7 @@ from typing import Literal, Optional
|
||||||
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
|
||||||
|
from ..utilities.utils import timedelta_from_string
|
||||||
from .base import AuroraBaseModel
|
from .base import AuroraBaseModel
|
||||||
from .partials import PartialUser
|
from .partials import PartialUser
|
||||||
|
|
||||||
|
@ -31,8 +32,7 @@ class Change(AuroraBaseModel):
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
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":
|
||||||
hours, minutes, seconds = map(int, data["duration"].split(':'))
|
duration = timedelta_from_string(data["duration"])
|
||||||
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
|
||||||
elif "duration" in data and isinstance(data["duration"], timedelta):
|
elif "duration" in data and isinstance(data["duration"], timedelta):
|
||||||
duration = data["duration"]
|
duration = data["duration"]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue