From 49ba5f617411ca2179a88146e6a722f15270532e Mon Sep 17 00:00:00 2001 From: sgoudham Date: Tue, 28 Jul 2020 10:11:10 +0100 Subject: [PATCH] On member joins are now sent to the modlog --- cogs/moderation.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cogs/moderation.py b/cogs/moderation.py index 488a0f8d..d1dd8a1a 100644 --- a/cogs/moderation.py +++ b/cogs/moderation.py @@ -356,6 +356,30 @@ class Moderation(Cog): await modlogs_channel.send(embed=embed) + @Cog.listener() + async def on_member_join(self, member): + """Sending Members that have joined to the Modlogs Channel""" + + # Get the guild within the cache + guild = get_modlog_for_guild(str(member.guild.id)) + + # When no modlogs channel is returned, do nothing + if guild is None: + pass + # Send the embed to the modlogs channel + else: + # Get the modlogs channel + modlogs_channel = self.bot.get_channel(int(guild)) + + embed = Embed(description="{} A.K.A {}".format(member.mention, member), + colour=enso_embedmod_colours, + timestamp=datetime.datetime.utcnow()) + embed.set_author(name="Member Joined", icon_url=member.avatar_url) + embed.set_thumbnail(url=member.avatar_url) + embed.set_footer(text="ID: {}".format(member.id)) + + await modlogs_channel.send(embed=embed) + def setup(bot): bot.add_cog(Moderation(bot))