fix(aurora): fixed some subscripting errors in changes_factory

This commit is contained in:
Seaswimmer 2024-05-04 21:19:06 -04:00
parent 6eeab9ed96
commit a8414a7918
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -2,13 +2,17 @@
from datetime import datetime, timedelta
from typing import Union
from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, 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, humanize_timedelta, warning
from redbot.core.utils.chat_formatting import (bold, box, error,
humanize_timedelta, warning)
from aurora.models import Moderation
from aurora.models import Moderation, PartialUser
from aurora.utilities.config import config
from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_bool_emoji, get_next_case_number, get_pagesize_str
from aurora.utilities.utils import (fetch_channel_dict, fetch_user_dict,
get_bool_emoji, get_next_case_number,
get_pagesize_str)
async def message_factory(
@ -227,29 +231,28 @@ async def changes_factory(interaction: Interaction, moderation: Moderation) -> E
if change.user_id not in memory_dict:
memory_dict[str(change.user_id)] = await change.get_user()
user = memory_dict[str(change.user_id)]
name = user["name"]
user: PartialUser = memory_dict[str(change.user_id)]
timestamp = f"<t:{change.unix_timestamp}> | <t:{change.unix_timestamp}:R>"
if change.type == "ORIGINAL":
embed.add_field(
name="Original",
value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
value=f"**User:** `{user.name}` ({user.id})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
inline=False,
)
elif change.type == "EDIT":
embed.add_field(
name="Edit",
value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
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:** `{name}` ({user['id']})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
value=f"**User:** `{user.name}` ({user.id})\n**Reason:** {change.reason}\n**Timestamp:** {timestamp}",
inline=False,
)