fix(aurora): fixing user dm messages in addrole
Some checks failed
Actions / Lint Code (Pylint) (push) Failing after 17s
Actions / Build Documentation (MkDocs) (push) Successful in 12s

This commit is contained in:
SeaswimmerTheFsh 2024-02-02 12:05:05 -05:00
parent 21dabccb48
commit 7d2b71667a
Signed by: cswimr
GPG key ID: B8953EC01E5C4063
2 changed files with 26 additions and 6 deletions

View file

@ -4,7 +4,16 @@ from datetime import datetime, timedelta
from typing import Union
import humanize
from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, 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
@ -26,6 +35,7 @@ async def message_factory(
moderator: Union[Member, User] = None,
duration: timedelta = None,
response: InteractionMessage = None,
role: Role = None,
) -> Embed:
"""This function creates a message from set parameters, meant for contacting the moderated user.
@ -37,6 +47,8 @@ async def message_factory(
moderator (Union[Member, User], optional): The moderator who performed the moderation. Defaults to None.
duration (timedelta, optional): The duration of the moderation. Defaults to None.
response (InteractionMessage, optional): The response message. Defaults to None.
role (Role, optional): The role that was added or removed. Defaults to None.
Returns:
embed: The message embed.
@ -58,10 +70,10 @@ async def message_factory(
if moderation_type == "note":
embed_desc = "received a"
elif moderation_type == "role added":
embed_desc = "received the"
elif moderation_type == "role removed":
embed_desc = "lost the"
elif moderation_type == "addrole":
embed_desc = f"received the {role.name} role"
elif moderation_type == "removerole":
embed_desc = f"lost the {role.name} role"
else:
embed_desc = "been"