WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
Showing only changes of commit ec082b58ad - Show all commits

View file

@ -5,7 +5,7 @@ from typing import Union
from discord import Color, Embed, Guild, Interaction, Member, Message, Role, User
from redbot.core import commands
from redbot.core.bot import Red
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, inline, warning
from ..models.moderation import Moderation
from ..models.partials import PartialUser
@ -261,27 +261,22 @@ async def changes_factory(interaction: Interaction, moderation: Moderation) -> E
user: PartialUser = memory_dict[str(change.user_id)]
timestamp = f"<t:{change.unix_timestamp}> | <t:{change.unix_timestamp}:R>"
end_timestamp = f"<t:{change.end_timestamp}> | <t:{change.end_timestamp}:R>" if change.end_timestamp else None
if change.type == "ORIGINAL":
embed.add_field(
name="Original",
value=f"**User:** `{user.name}` ({user.id})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
inline=False,
)
change_str = [
f"{bold("User:")} {inline(user.name)} ({user.id})",
f"{bold("Reason:")} {change.reason}" if change.reason else "",
f"{bold('Duration:')} {humanize_timedelta(timedelta=change.duration)}" if change.duration else "",
f"{bold('End Timestamp:')} {end_timestamp}" if end_timestamp else "",
f"{bold("Timestamp:")} {timestamp}",
]
change_str.remove("")
elif change.type == "EDIT":
embed.add_field(
name="Edit",
value=f"**User:** `{user.name}` ({user.id})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
inline=False,
)
elif change.type == "RESOLVE":
embed.add_field(
name="Resolve",
value=f"**User:** `{user.name}` ({user.id})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
inline=False,
)
embed.add_field(
name=change.type.title(),
value=change_str.join("\n"),
inline=False,
)
else:
embed.description = "*No changes have been made to this case.* 🙁"