fix(moderation): fixed history embeds taking 3 years to process
This commit is contained in:
parent
a67b1f8ccb
commit
be565f9458
1 changed files with 8 additions and 2 deletions
|
@ -243,7 +243,9 @@ class Moderation(commands.Cog):
|
|||
async def fetch_user_dict(self, interaction: discord.Interaction, user_id: str):
|
||||
"""This method returns a dictionary containing either user information or a standard deleted user template."""
|
||||
try:
|
||||
user = await interaction.client.fetch_user(user_id)
|
||||
user = interaction.client.get_user(user_id)
|
||||
if user is None:
|
||||
user = await interaction.client.fetch_user(user_id)
|
||||
user_dict = {
|
||||
'id': user.id,
|
||||
'name': user.name,
|
||||
|
@ -387,6 +389,10 @@ class Moderation(commands.Cog):
|
|||
except discord.errors.Forbidden:
|
||||
return
|
||||
|
||||
#######################################################################################################################
|
||||
### COMMANDS
|
||||
#######################################################################################################################
|
||||
|
||||
@app_commands.command(name="note")
|
||||
async def note(self, interaction: discord.Interaction, target: discord.User, reason: str, silent: bool = None):
|
||||
"""Add a note to a user.
|
||||
|
@ -777,7 +783,7 @@ class Moderation(commands.Cog):
|
|||
for case in result_dict_list[start_index:end_index]:
|
||||
target_user = await self.fetch_user_dict(interaction, case['target_id'])
|
||||
moderator_user = await self.fetch_user_dict(interaction, case['moderator_id'])
|
||||
target_name = f"`{target_user['name']}`" if target_user['discriminator'] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
|
||||
target_name = target_user['name'] if target_user['discriminator'] == "0" else f"{target_user['name']}#{target_user['discriminator']}"
|
||||
moderator_name = moderator_user['name'] if moderator_user['discriminator'] == "0" else f"{moderator_user['name']}#{moderator_user['discriminator']}"
|
||||
field_name = f"Case #{case['moderation_id']} ({str.title(case['moderation_type'])})"
|
||||
field_value = f"**Target:** `{target_name}` ({target_user['id']})\n**Moderator:** `{moderator_name}` ({moderator_user['id']})\n**Reason:** `{str(case['reason'])[:150]}`"
|
||||
|
|
Loading…
Reference in a new issue