feat(moderation): added embed generator for changes

This commit is contained in:
Seaswimmer 2023-12-14 20:27:07 -05:00
parent 5f5fe459cb
commit 817f2d8622
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -439,6 +439,27 @@ class Moderation(commands.Cog):
return embed 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"<t:{change['timestamp']}> | <t:{change['timestamp']}:R>"
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 embed_type == 'log':
if resolved: if resolved:
target_user = await self.fetch_user_dict(interaction, case_dict['target_id']) target_user = await self.fetch_user_dict(interaction, case_dict['target_id'])