forked from cswimr/SeaCogs
feat(moderation): added embed generator for changes
This commit is contained in:
parent
5f5fe459cb
commit
817f2d8622
1 changed files with 21 additions and 0 deletions
|
@ -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"<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 resolved:
|
||||
target_user = await self.fetch_user_dict(interaction, case_dict['target_id'])
|
||||
|
|
Loading…
Reference in a new issue