Logging only custom activities

pull/9/head
sgoudham 4 years ago
parent 63146944ce
commit 8db1563d2b

@ -562,34 +562,29 @@ class Moderation(Cog):
if modlogs := self.bot.get_modlog_for_guild(after.guild.id): if modlogs := self.bot.get_modlog_for_guild(after.guild.id):
modlogs_channel = self.bot.get_channel(modlogs) modlogs_channel = self.bot.get_channel(modlogs)
# Logging nickname changes # Logging nickname changes or custom activity updates
if before.nick != after.nick or ( if before.nick != after.nick or (
before.activity != after.activity and ( before.activity != after.activity and (
after.activity.type == discord.ActivityType.custom if after.activity else None)): after.activity.type == discord.ActivityType.custom if after.activity else None)):
# Getting emoji of status from dict # Get the status of the member
for key, value in member_status.items(): after_status = member_status[str(after.status)]
if key == str(before.status):
before_status = value
if key == str(after.status):
after_status = value
# Getting activity # Getting activity
after_activity = f"{after.activity.emoji or ''} {after.activity.name}" after_activity = f"{after.activity.emoji or ''} {after.activity.name}"
before_activity = f"{before.activity.emoji or ''} {before.activity.name}" before_activity = f"{before.activity.emoji or ''} {before.activity.name}"
fields = [("Before", fields = [("Before",
f"**Nickname -->** {before.nick or 'None'}\n" f"**Nickname -->** {before.nick or None}\n"
f"**Status -->** {before_status or 'None'}\n" f"**Activity -->** {before_activity}", False),
f"**Activity -->** {before_activity}\n", False),
("After", ("After",
f"**Nickname -->** {after.nick or 'None'}\n" f"**Nickname -->** {after.nick or None}\n"
f"**Status -->** {after_status or 'None'}\n" f"**Activity -->** {after_activity}", False)]
f"**Activity -->** {after_activity}\n", False)]
embed = Embed(title="Member Updated", embed = Embed(title="Member Updated",
description=f"**Member --> {after.mention} |** {after}" description=f"**Member --> {after.mention} |** {after}"
f"\n**ID -->** {after.id}", f"\n**ID -->** {after.id}"
f"\n**Status -->** {after_status}",
colour=self.bot.admin_colour, colour=self.bot.admin_colour,
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())
embed.set_author(name=after, icon_url=after.avatar_url) embed.set_author(name=after, icon_url=after.avatar_url)

Loading…
Cancel
Save