forked from cswimr/SeaCogs
fix(aurora): fixing user dm messages in addrole
This commit is contained in:
parent
21dabccb48
commit
7d2b71667a
2 changed files with 26 additions and 6 deletions
|
@ -372,9 +372,10 @@ class Aurora(commands.Cog):
|
|||
guild=interaction.guild,
|
||||
moderator=interaction.user,
|
||||
reason=reason,
|
||||
moderation_type=f"`{role.name}` role",
|
||||
moderation_type=f"addrole",
|
||||
response=await interaction.original_response(),
|
||||
duration=parsed_time,
|
||||
role=role
|
||||
)
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
|
@ -1078,6 +1079,13 @@ class Aurora(commands.Cog):
|
|||
f"\n**Timestamp:** <t:{case['timestamp']}> | <t:{case['timestamp']}:R>"
|
||||
)
|
||||
|
||||
if case["role_id"] != 0:
|
||||
role = interaction.guild.get_role(case["role_id"])
|
||||
if not role:
|
||||
field_value += f"\n**Role:** Deleted Role ({case['role_id']})"
|
||||
else:
|
||||
field_value += f"\n**Role:** {role.mention}"
|
||||
|
||||
if bool(case["resolved"]):
|
||||
field_value += "\n**Resolved:** True"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue