fix(aurora): fixed aurora.utilities.utils.timedelta_from_string not including days in its calculations

This commit is contained in:
Seaswimmer 2024-06-04 23:43:53 -04:00
parent 78630dc317
commit 8591649465
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -196,16 +196,15 @@ def timedelta_from_relativedelta(relativedelta: rd) -> timedelta:
def timedelta_from_string(string: str) -> timedelta:
"""Converts a string to a timedelta object."""
from .logger import logger
hours, minutes, seconds = map(int, string.split(":"))
logger.debug("%s | hours: %s, minutes: %s, seconds: %s", string, hours, minutes, seconds)
return timedelta(hours=hours, minutes=minutes, seconds=seconds)
def timedelta_to_string(timedelta: timedelta) -> str:
"""Converts a timedelta object to a string."""
days = timedelta.days * 24
hours, remainder = divmod(timedelta.seconds, 3600)
minutes, seconds = divmod(remainder, 60)
return f"{hours}:{minutes}:{seconds}"
return f"{days + hours}:{minutes:02}:{seconds:02}"
def get_footer_image(coginstance: commands.Cog) -> File:
"""Returns the footer image for the embeds."""