Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom roles logs #277

Merged
merged 12 commits into from
Nov 21, 2023
16 changes: 12 additions & 4 deletions bot/extensions/custom_roles/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,20 @@ async def on_custom_role_update(self, before: CustomRole, after: CustomRole):
timestamp=datetime.datetime.utcnow(),
)

embed.add_field(name="Old Name", value=before.name)
embed.add_field(name="New Name", value=after.name)
if before.name == after.name:
embed.add_field(name="Name", value=before.name)
else:
embed.add_field(name="Name (Updated)", value=f"{before.name} -> {after.name}")

embed.add_field(name="\u200B", value="\u200B")
embed.add_field(name="Old Color", value="#" + hex(before.color)[2:])
embed.add_field(name="New Color", value="#" + hex(after.color)[2:])

if before.color == after.color:
embed.add_field(name="Color", value="#" + hex(after.color)[2:])
else:
embed.add_field(name="Color (Updated)", value=f"#{hex(before.color)[2:]} -> #{hex(after.color)[2:]}")

embed.set_thumbnail(url=user.avatar)
embed.set_author(name=user.name, icon_url=user.avatar)
embed.set_footer(text=f"user_id: {after.user_id}")

return await self.custom_roles_logs_channel.send(embed=embed)
Loading