From 16c74997ee45e746b3f3b997dee8a46f6a982629 Mon Sep 17 00:00:00 2001 From: flifloo Date: Mon, 2 Nov 2020 12:30:26 +0100 Subject: [PATCH] Fix of invites update --- extensions/invite.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extensions/invite.py b/extensions/invite.py index 7d6ac86..48204fd 100644 --- a/extensions/invite.py +++ b/extensions/invite.py @@ -71,10 +71,6 @@ class Invite(commands.Cog): for g in self.bot.guilds: self.invites[g.id] = await g.invites() - @commands.Cog.listener() - async def on_ready(self): - await self.update_invites() - @commands.Cog.listener() async def on_member_join(self, member: Member): user_invites = await member.guild.invites() @@ -91,6 +87,10 @@ class Invite(commands.Cog): pass self.invites[member.guild.id] = user_invites + @commands.Cog.listener() + async def on_invite_create(self, invite): + self.invites[invite.guild.id] = await invite.guild.invites() + @commands.Cog.listener() async def on_invite_delete(self, invite): s = db.Session() @@ -99,6 +99,7 @@ class Invite(commands.Cog): s.delete(invite_role) s.commit() s.close() + self.invites[invite.guild.id] = await invite.guild.invites() @commands.Cog.listener() async def on_guild_join(self, guild: Guild):