aboutsummaryrefslogblamecommitdiff
path: root/cogs/errorhandler.py
blob: 8533a61099da85e604953caf4710a31bbb47b832 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                 
                                                                                                                                                      





                                      
from discord.ext import commands


class Errorhandler(commands.Cog):
	def __init__(self, bot):
		self.bot = bot

	@commands.Cog.listener()
	async def on_command_error(self, ctx, error):
		if isinstance(error, commands.CommandNotFound):
			return

		if isinstance(error, commands.CommandOnCooldown):
			return await ctx.send(f'{ctx.author.mention}, you have to wait {round(error.retry_after, 2)} seconds before using this again')

		raise error


def setup(bot):
	bot.add_cog(Errorhandler(bot))