from discord.ext import commands class EventCog(commands.Cog): def __init__(self, bot): self.bot = bot self.bot.on_error = self.on_error # Syncs commands, sets the game, and logs when the bot logs in @commands.Cog.listener() async def on_ready(self): await self.bot.eventHandler.on_ready() # Logs when user sends a command @commands.Cog.listener() async def on_slash_command(self, ctx): await self.bot.eventHandler.on_slash_command(ctx) # Logs if a command experiences an error @commands.Cog.listener() async def on_slash_command_error(self, ctx, error): await self.bot.errorHandler.on_slash_command_error(ctx, error) # Logs if on error occurs async def on_error(self, method, *args, **kwargs): await self.bot.errorHandler.on_error(method) # If someone reacted to a message, checks if it's a reaction it's # Gwendolyn has been waiting for, and then does something @commands.Cog.listener() async def on_reaction_add(self, reaction, user): await self.bot.eventHandler.on_reaction_add(reaction, user) def setup(bot): bot.add_cog(EventCog(bot))