Add listener decorator to events

This commit is contained in:
Dustin Pianalto 2019-12-16 16:03:32 -09:00
parent 1b130da551
commit d1660e4ca3

View File

@ -10,6 +10,7 @@ class GuildEvents(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self, guild): async def on_guild_join(self, guild):
default_config = { default_config = {
'prefixes': [self.bot.default_prefix], 'prefixes': [self.bot.default_prefix],
@ -33,6 +34,7 @@ class GuildEvents(commands.Cog):
guild_logger.info(f'All Entries Created for {guild.name}') guild_logger.info(f'All Entries Created for {guild.name}')
await guild.me.edit(nick=f'[{self.bot.default_prefix}] Geeksbot') await guild.me.edit(nick=f'[{self.bot.default_prefix}] Geeksbot')
@commands.Cog.listener()
async def on_guild_remove(self, guild): async def on_guild_remove(self, guild):
resp = await self.bot.aio_session.delete(f'{self.bot.api_base}/guilds/{guild.id}/', resp = await self.bot.aio_session.delete(f'{self.bot.api_base}/guilds/{guild.id}/',
headers=self.bot.auth_header) headers=self.bot.auth_header)