misc(aurora): convert Change.from_dict()
to use utils.timedelta_from_string()
This commit is contained in:
parent
8591649465
commit
0d64e3f652
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 ..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:
|
||||
|
|
Loading…
Reference in a new issue