diff --git a/aurora/utilities/factory.py b/aurora/utilities/factory.py index b7c414c..c7b41c7 100644 --- a/aurora/utilities/factory.py +++ b/aurora/utilities/factory.py @@ -2,16 +2,12 @@ from datetime import datetime, timedelta from typing import Union -import humanize -from discord import (Color, Embed, Guild, Interaction, InteractionMessage, - Member, Role, User) +from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, User from redbot.core import commands -from redbot.core.utils.chat_formatting import bold, box, error, warning +from redbot.core.utils.chat_formatting import bold, box, error, humanize_timedelta, warning from aurora.utilities.config import config -from aurora.utilities.utils import (fetch_channel_dict, fetch_user_dict, - get_bool_emoji, get_next_case_number, - get_pagesize_str) +from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_bool_emoji, get_next_case_number, get_pagesize_str async def message_factory( @@ -51,7 +47,7 @@ async def message_factory( guild_name = guild.name if moderation_type in ["tempbanned", "muted"] and duration: - embed_duration = f" for {humanize.precisedelta(duration)}" + embed_duration = f" for {humanize_timedelta(timedelta=duration)}" else: embed_duration = "" @@ -141,9 +137,9 @@ async def log_factory( } ) duration_embed = ( - f"{humanize.precisedelta(td)} | " + f"{humanize_timedelta(timedelta=td)} | " if case_dict["expired"] == "0" - else str(humanize.precisedelta(td)) + else str(humanize_timedelta(timedelta=td)) ) embed.description = ( embed.description @@ -204,7 +200,7 @@ async def log_factory( ) embed.description = ( embed.description - + f"\n**Duration:** {humanize.precisedelta(td)} | " + + f"\n**Duration:** {humanize_timedelta(timedelta=td)} | " ) embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False) @@ -255,9 +251,9 @@ async def case_factory(interaction: Interaction, case_dict: dict) -> Embed: } ) duration_embed = ( - f"{humanize.precisedelta(td)} | " + f"{humanize_timedelta(timedelta=td)} | " if bool(case_dict["expired"]) is False - else str(humanize.precisedelta(td)) + else str(humanize_timedelta(timedelta=td)) ) embed.description += f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}" @@ -379,7 +375,7 @@ async def evidenceformat_factory(interaction: Interaction, case_dict: dict) -> s if case_dict["duration"] != "NULL": hours, minutes, seconds = map(int, case_dict["duration"].split(":")) td = timedelta(hours=hours, minutes=minutes, seconds=seconds) - content += f"\nDuration: {humanize.precisedelta(td)}" + content += f"\nDuration: {humanize_timedelta(timedelta=td)}" content += f"\nReason: {case_dict['reason']}"