fix(aurora): fixed some subscripting errors in changes_factory
This commit is contained in:
parent
6eeab9ed96
commit
a8414a7918
1 changed files with 12 additions and 9 deletions
|
@ -2,13 +2,17 @@
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Union
|
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 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.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(
|
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:
|
if change.user_id not in memory_dict:
|
||||||
memory_dict[str(change.user_id)] = await change.get_user()
|
memory_dict[str(change.user_id)] = await change.get_user()
|
||||||
|
|
||||||
user = memory_dict[str(change.user_id)]
|
user: PartialUser = memory_dict[str(change.user_id)]
|
||||||
name = user["name"]
|
|
||||||
|
|
||||||
timestamp = f"<t:{change.unix_timestamp}> | <t:{change.unix_timestamp}:R>"
|
timestamp = f"<t:{change.unix_timestamp}> | <t:{change.unix_timestamp}:R>"
|
||||||
|
|
||||||
if change.type == "ORIGINAL":
|
if change.type == "ORIGINAL":
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Original",
|
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,
|
inline=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
elif change.type == "EDIT":
|
elif change.type == "EDIT":
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Edit",
|
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,
|
inline=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
elif change.type == "RESOLVE":
|
elif change.type == "RESOLVE":
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Resolve",
|
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,
|
inline=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue