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):