WIP: Refactor Aurora (3.0.0) #29
1 changed files with 6 additions and 2 deletions
|
@ -207,8 +207,12 @@ class Moderation(AuroraGuildModel):
|
||||||
@classmethod
|
@classmethod
|
||||||
async def from_result(cls, bot: Red, result: Iterable, guild_id: int) -> "Moderation":
|
async def from_result(cls, bot: Red, result: Iterable, guild_id: int) -> "Moderation":
|
||||||
if result[7] is not None and result[7] != "NULL":
|
if result[7] is not None and result[7] != "NULL":
|
||||||
|
try:
|
||||||
hours, minutes, seconds = map(int, result[7].split(':'))
|
hours, minutes, seconds = map(int, result[7].split(':'))
|
||||||
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
duration = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
||||||
|
except ValueError as e:
|
||||||
|
logger.error("Error parsing duration for case %s: %s", result[0], result[7])
|
||||||
|
raise e
|
||||||
else:
|
else:
|
||||||
duration = None
|
duration = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue