From 0d64e3f6520f101c7c25380f40245ddc5032b3b7 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Tue, 4 Jun 2024 23:52:35 -0400 Subject: [PATCH] misc(aurora): convert `Change.from_dict()` to use `utils.timedelta_from_string()` --- aurora/models/change.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aurora/models/change.py b/aurora/models/change.py index d3fdd99..22ac222 100644 --- a/aurora/models/change.py +++ b/aurora/models/change.py @@ -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: