forked from cswimr/SeaCogs
fix(aurora): updated message_factory for addrole support
This commit is contained in:
parent
cd514d0535
commit
38b0580228
1 changed files with 10 additions and 8 deletions
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue