-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvites.py
More file actions
31 lines (24 loc) · 868 Bytes
/
Copy pathInvites.py
File metadata and controls
31 lines (24 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import discord
import DiscordUtils
from discord.ext import commands
class Invites(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.tracker = DiscordUtils.InviteTracker(bot)
@commands.Cog.listener()
async def on_ready(self):
await self.tracker.cache_invites()
@commands.Cog.listener()
async def on_invite_create(self, invite):
await self.tracker.update_invite_cache(invite)
@commands.Cog.listener()
async def on_guild_join(self, guild):
await self.tracker.update_guild_cache(guild)
@commands.Cog.listener()
async def on_invite_delete(self, invite):
await self.tracker.remove_invite_cache(invite)
@commands.Cog.listener()
async def on_guild_remove(self, guild):
await self.tracker.remove_guild_cache(guild)
def setup(bot):
bot.add_cog(Invites(bot))