fix(aurora): make changes_factory support changes properly
This commit is contained in:
parent
b0509d748c
commit
ec082b58ad
1 changed files with 15 additions and 20 deletions
|
@ -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,25 +261,20 @@ 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}",
|
||||
name=change.type.title(),
|
||||
value=change_str.join("\n"),
|
||||
inline=False,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue