WIP: Refactor Aurora (3.0.0) #29
1 changed files with 2 additions and 3 deletions
|
@ -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."""
|
||||
|
|
Loading…
Reference in a new issue