fix(aurora): fixed using interaction instead of passing a member/user object
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 41s
All checks were successful
Pylint / Pylint (3.11) (push) Successful in 41s
This commit is contained in:
parent
eaf08f2e08
commit
a96f461a63
2 changed files with 15 additions and 13 deletions
|
@ -1,15 +1,16 @@
|
|||
# pylint: disable=cyclic-import
|
||||
|
||||
from typing import Union
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import humanize
|
||||
from discord import Color, Embed, Guild, Interaction, InteractionMessage
|
||||
from discord import Color, Embed, Guild, Interaction, InteractionMessage, User, Member
|
||||
|
||||
from .config import config
|
||||
from .utils import fetch_channel_dict, fetch_user_dict, get_next_case_number
|
||||
|
||||
|
||||
async def embed_factory(embed_type: str, color: Color, /, interaction: Interaction = None, case_dict: dict = None, guild: Guild = None, reason: str = None, moderation_type: str = None, response: InteractionMessage = None, duration: timedelta = None, resolved: bool = False):
|
||||
async def embed_factory(embed_type: str, color: Color, /, interaction: Interaction = None, case_dict: dict = None, guild: Guild = None, reason: str = None, moderator: Union[Member, User] = None, moderation_type: str = None, response: InteractionMessage = None, duration: timedelta = None, resolved: bool = False):
|
||||
"""This method creates an embed from set parameters, meant for either moderation logging or contacting the moderated user.
|
||||
|
||||
Valid arguments for 'embed_type':
|
||||
|
@ -23,6 +24,7 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
- reason
|
||||
- moderation_type
|
||||
- response
|
||||
- moderator (optional)
|
||||
- duration (optional)
|
||||
|
||||
Required arguments for 'log':
|
||||
|
@ -53,8 +55,8 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
|
||||
embed = Embed(title=str.title(moderation_type), description=f"You have {embed_desc} {moderation_type}{embed_duration} in {guild_name}.", color=color, timestamp=datetime.now())
|
||||
|
||||
if await config.guild(guild).show_moderator():
|
||||
embed.add_field(name='Moderator', value=f"`{interaction.user.name} ({interaction.user.id})`", inline=False)
|
||||
if await config.guild(guild).show_moderator() and moderator is not None:
|
||||
embed.add_field(name='Moderator', value=f"`{moderator.name} ({moderator.id})`", inline=False)
|
||||
|
||||
embed.add_field(name='Reason', value=f"`{reason}`", inline=False)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue