Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import os
- import logging
- from config import PREFIX, RED
- from discord.ext import commands
- class Events(commands.Cog, name='Events', description='Events and triggeres that run in the background.'):
- def __init__(self, client):
- self.client = client
- @commands.Cog.listener()
- async def on_ready(self):
- client = self.client
- print(f'Logged in as {self.client.user} (ID: {self.client.user.id})')
- print('------')
- @commands.Cog.listener()
- async def on_messege_delete(self, ctx, messege):
- return
- @commands.Cog.listener()
- async def on_command_error(self, ctx, error):
- error_message = f'\⛔ {error}'
- if isinstance(error, commands.BadArgument):
- e = discord.Embed(
- description=error_message,
- color=RED
- )
- await ctx.send(embed=e, mention_author=False)
- if isinstance(error, commands.MissingRequiredArgument):
- e = discord.Embed(
- description=error_message,
- color=RED
- )
- await ctx.send(embed=e, mention_author=False)
- elif isinstance(error, commands.CommandOnCooldown):
- e = discord.Embed(
- description=error_message,
- color=RED
- )
- await ctx.send(embed=e, mention_author=False)
- elif isinstance(error, commands.MissingPermissions):
- e = discord.embed(
- description=error_message,
- color=RED
- )
- await ctx.send(embed=e, mention_author=False)
- elif isinstance(error, commands.ConversionError):
- e = discord.Embed(
- description=error_message,
- color=RED
- )
- await ctx.send(embed=e, mention_author=False)
- elif isinstance(error, commands.CommandNotFound):
- return
- else:
- e = discord.Embed(
- description=error_message,
- color=RED
- )
- await ctx.send(embed=e, mention_author=False)
- raise error
- def setup(client):
- client.add_cog(Events(client))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement