From 5a53e3327be56e092e3c4774483fa7e299eb7b43 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 28 Dec 2023 05:01:08 -0500 Subject: [PATCH] fix(aurora): fixed durations, again --- aurora/utilities/database.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/aurora/utilities/database.py b/aurora/utilities/database.py index 762214b..88189dc 100644 --- a/aurora/utilities/database.py +++ b/aurora/utilities/database.py @@ -3,7 +3,7 @@ import json import time import sqlite3 -from datetime import datetime +from datetime import datetime, timedelta from discord import Guild from redbot.core import data_manager @@ -110,7 +110,7 @@ async def mysql_log( target_type: str, target_id: int, role_id: int, - duration, + duration: timedelta, reason: str, database: sqlite3.Connection = None, timestamp: int = None, @@ -127,7 +127,12 @@ async def mysql_log( if duration != "NULL": end_timedelta = datetime.fromtimestamp(timestamp) + duration end_timestamp = int(end_timedelta.timestamp()) - duration = str(duration) + + total_seconds = int(duration.total_seconds()) + hours = total_seconds // 3600 + minutes = (total_seconds % 3600) // 60 + seconds = total_seconds % 60 + duration = f"{hours}:{minutes}:{seconds}" else: end_timestamp = 0