From 1924eab35570f0a7a990512ce2a0462170c92dbc Mon Sep 17 00:00:00 2001 From: Ellie Date: Sun, 19 May 2019 02:00:28 +0200 Subject: [PATCH] Update infochannel.py (#53) Thanks for the help! --- infochannel/infochannel.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infochannel/infochannel.py b/infochannel/infochannel.py index 4544b1c..e6248fc 100644 --- a/infochannel/infochannel.py +++ b/infochannel/infochannel.py @@ -6,6 +6,11 @@ from redbot.core.bot import Red Cog: Any = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x class InfoChannel(Cog): """ @@ -115,8 +120,10 @@ class InfoChannel(Cog): await channel.edit(reason="InfoChannel update", name=name) + @listener() async def on_member_join(self, member: discord.Member): await self.update_infochannel(member.guild) + @listener() async def on_member_remove(self, member: discord.Member): await self.update_infochannel(member.guild)