aboutsummaryrefslogtreecommitdiff
path: root/cogs/errorhandler.py
diff options
context:
space:
mode:
Diffstat (limited to 'cogs/errorhandler.py')
-rw-r--r--cogs/errorhandler.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/cogs/errorhandler.py b/cogs/errorhandler.py
new file mode 100644
index 0000000..8533a61
--- /dev/null
+++ b/cogs/errorhandler.py
@@ -0,0 +1,20 @@
+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))