Logging banner url changes

pull/9/head
sgoudham 4 years ago
parent 0a125c8822
commit 0d3e5b8a35

@ -899,16 +899,15 @@ class Moderation(Cog):
async def on_guild_update(self, before, after): async def on_guild_update(self, before, after):
"""Logging guild updates""" """Logging guild updates"""
# TODO: ADD LOGGING FOR ROLES/EMOJIS/FEATURES/SPLASH URLS ETC ETC.
if modlogs := self.bot.get_modlog_for_guild(after.id): if modlogs := self.bot.get_modlog_for_guild(after.id):
modlogs_channel = self.bot.get_channel(modlogs) modlogs_channel = self.bot.get_channel(modlogs)
attributes = ["name", "verification_level", "afk_channel", "mfa_level", "icon_url", attributes = ["name", "verification_level", "afk_channel", "mfa_level", "icon_url",
"default_notifications", "region", "explicit_content_filter"] "default_notifications", "region", "explicit_content_filter"]
if any(getattr(before, x) != getattr(after, x) for x in attributes): if any(getattr(before, x) != getattr(after, x) for x in attributes):
# TODO: ADD LOGGING FOR ROLES/EMOJIS/FEATURES/SPLASH URLS ETC ETC.
fields = [("Before", fields = [("Before",
f"**Guild Name -->** {before}\n" f"**Guild Name -->** {before}\n"
f"**Region -->** {get_region(str(before.region))}\n\n" f"**Region -->** {get_region(str(before.region))}\n\n"
@ -947,6 +946,18 @@ class Moderation(Cog):
await modlogs_channel.send(embed=embed) await modlogs_channel.send(embed=embed)
if before.banner != after.banner:
embed = Embed(title="Banner Updated",
colour=self.bot.admin_colour,
timestamp=datetime.datetime.utcnow())
embed.set_author(name=after, icon_url=after.icon_url)
embed.add_field(name="New Banner",
value=f"[Link To New Banner]({after.banner_url})", inline=False)
embed.set_image(url=after.banner_url)
embed.set_footer(text="Banner Updated")
await modlogs_channel.send(embed=embed)
def setup(bot): def setup(bot):
bot.add_cog(Moderation(bot)) bot.add_cog(Moderation(bot))

Loading…
Cancel
Save