From 6eeab9ed96ae1f1fd2c92e7d4b2745ea287aa060 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sat, 4 May 2024 21:17:03 -0400 Subject: [PATCH] fix(aurora): fixed a keyerror --- aurora/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aurora/models.py b/aurora/models.py index a7b81a7..f00f0b5 100644 --- a/aurora/models.py +++ b/aurora/models.py @@ -118,14 +118,14 @@ class Change(AuroraBaseModel): @classmethod def from_dict(cls, bot: Red, data: dict) -> "Change": - if data["duration"] is not None: + if "duration" in data and data["duration"] is not None: hours, minutes, seconds = map(int, data["duration"].split(':')) duration = timedelta(hours=hours, minutes=minutes, seconds=seconds) else: duration = None data.update({ "timestamp": datetime.fromtimestamp(data["timestamp"]), - "end_timestamp": datetime.fromtimestamp(data["end_timestamp"]) if data["end_timestamp"] else None, + "end_timestamp": datetime.fromtimestamp(data["end_timestamp"]) if "end_timestamp" in data and data["end_timestamp"] else None, "duration": duration }) return cls(bot=bot, **data)