From 38b0580228f8531c969100b0faa46d64ba67d46f Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 3 May 2024 21:01:11 -0400 Subject: [PATCH] fix(aurora): updated message_factory for addrole support --- aurora/utilities/factory.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/aurora/utilities/factory.py b/aurora/utilities/factory.py index 3cfaf9e..86aee24 100644 --- a/aurora/utilities/factory.py +++ b/aurora/utilities/factory.py @@ -2,16 +2,12 @@ from datetime import datetime, timedelta from typing import Union -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, - humanize_timedelta, 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( @@ -50,6 +46,8 @@ async def message_factory( else: guild_name = guild.name + title = moderation_type + if moderation_type in ["tempbanned", "muted"] and duration: embed_duration = f" for {humanize_timedelta(timedelta=duration)}" else: @@ -59,13 +57,17 @@ async def message_factory( embed_desc = "received a" elif moderation_type == "addrole": embed_desc = f"received the {role.name} role" + title = "Role Added" + moderation_type = "" elif moderation_type == "removerole": embed_desc = f"lost the {role.name} role" + title = "Role Removed" + moderation_type = "" else: embed_desc = "been" embed = Embed( - title=str.title(moderation_type), + title=str.title(title), description=f"You have {embed_desc} {moderation_type}{embed_duration} in {guild_name}.", color=color, timestamp=datetime.now(),