misc(aurora): reworked embed_factory
All checks were successful
Build Documentation and Lint Code / build and lint (push) Successful in 22s

This commit is contained in:
SeaswimmerTheFsh 2024-01-08 09:18:54 +00:00
parent e4d7c5757a
commit aefb68e913
Signed by: cswimr
GPG key ID: D74DDDDF420E13DF
4 changed files with 246 additions and 239 deletions

View file

@ -193,7 +193,7 @@ async def fetch_role_dict(interaction: Interaction, role_id: str):
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False):
"""This function sends a message to the guild's configured logging channel when an infraction takes place."""
from .database import fetch_case
from .embed_factory import embed_factory
from .factory import log_factory
logging_channel_id = await config.guild(interaction.guild).log_channel()
if logging_channel_id != " ":
@ -201,9 +201,7 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal
case = await fetch_case(moderation_id, interaction.guild.id)
if case:
embed = await embed_factory(
"log", await interaction.client.get_embed_color(interaction.channel), interaction=interaction, case_dict=case, resolved=resolved
)
embed = await log_factory(interaction=interaction, case_dict=case, resolved=resolved)
try:
await logging_channel.send(embed=embed)
except Forbidden:
@ -211,7 +209,7 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal
async def send_evidenceformat(interaction: Interaction, case_dict: dict):
"""This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel."""
from .embed_factory import embed_factory
from .factory import evidenceformat_factory
send_evidence_bool = (await config.user(interaction.user).auto_evidenceformat()
or await config.guild(interaction.guild).auto_evidenceformat()
@ -219,9 +217,7 @@ async def send_evidenceformat(interaction: Interaction, case_dict: dict):
if send_evidence_bool is False:
return
content = await embed_factory(
"evidenceformat", await interaction.client.get_embed_color(None), interaction=interaction, case_dict=case_dict
)
content = await evidenceformat_factory(interaction=interaction, case_dict=case_dict)
await interaction.followup.send(content=content, ephemeral=True)
def convert_timedelta_to_str(timedelta: td) -> str: