diff --git a/moderation/moderation.py b/moderation/moderation.py index 8797b5e..534bbe0 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -780,9 +780,14 @@ class Moderation(commands.Cog): embed = discord.Embed(color=await self.bot.get_embed_color(None)) embed.set_author(icon_url=interaction.guild.icon.url, name='Infraction History') embed.set_footer(text=f"Page {page}/{page_quantity} | {case_quantity} Results") + memory_dict = {} 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']) + if case['target_id'] not in memory_dict: + memory_dict[str(case['target_id'])] = await self.fetch_user_dict(interaction, case['target_id']) + target_user = memory_dict[str(case['target_id'])] + if case['moderator_id'] not in memory_dict: + memory_dict[str(case['moderator_id'])] = await self.fetch_user_dict(interaction, case['moderator_id']) + moderator_user = memory_dict[str(case['moderator_id'])] 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'])})"