Files
Gwendolyn/cogs/EventCog.py
2021-04-03 22:35:11 +02:00

30 lines
904 B
Python

import discord
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)
def setup(bot):
bot.add_cog(EventCog(bot))