From 817f2d86228228b99b230f239be2701bbe805a21 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 14 Dec 2023 20:27:07 -0500 Subject: [PATCH] feat(moderation): added embed generator for changes --- moderation/moderation.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/moderation/moderation.py b/moderation/moderation.py index 7e51cd3..a78caf4 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -439,6 +439,27 @@ class Moderation(commands.Cog): return embed + if embed_type == 'changes': + embed = discord.Embed(title=f"📕 Case #{case_dict['moderation_id']} Changes", color=await self.bot.get_embed_color(None)) + + memory_dict = {} + + if case_dict['changes']: + for change in case_dict['changes']: + if change['user_id'] not in memory_dict: + memory_dict[str(change['user_id'])] = await self.fetch_user_dict(interaction, change['user_id']) + user = memory_dict[str(change['user_id'])] + name = user['name'] if user['discriminator'] == "0" else f"{user['name']}#{user['discriminator']}" + timestamp = f" | " + if change['type'] == 'ORIGINAL': + embed.add_field(name='Original', value=f"**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}", inline=False) + elif change['type'] == 'RESOLVE': + embed.add_field(name='Resolve', value=f"**User:** `{name}` ({user['id']})\n**Reason:** {change['reason']}\n**Timestamp:** {timestamp}", inline=False) + + return embed + if embed_type == 'log': if resolved: target_user = await self.fetch_user_dict(interaction, case_dict['target_id'])