From 88e173efa2583f100d337027e77b595a45cdb574 Mon Sep 17 00:00:00 2001 From: Dylan Dizon <onemyned@gmail.com> Date: Mon, 26 Nov 2018 20:02:38 -0500 Subject: [PATCH] Add minimal error catching for command invocations --- src/run.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/run.py b/src/run.py index dea7df5..a680b45 100644 --- a/src/run.py +++ b/src/run.py @@ -160,14 +160,16 @@ async def on_error(error, *args, **kwargs): @bot.event async def on_command_error(ctx, error): with suppress(err.NotFound): - if isinstance(error, errext.CommandOnCooldown): - await ctx.message.add_reaction('\N{HOURGLASS}') - await asyncio.sleep(error.retry_after) - await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}') - elif isinstance(error, err.NotFound): + if isinstance(error, err.NotFound): print('NOT FOUND') elif isinstance(error, err.Forbidden): pass + elif isinstance(error, errext.CommandInvokeError): + print('INVOCATION ERROR') + elif isinstance(error, errext.CommandOnCooldown): + await u.add_reaction(ctx.message, '\N{HOURGLASS}') + await asyncio.sleep(error.retry_after) + await u.add_reaction(ctx.message, '\N{WHITE HEAVY CHECK MARK}') elif isinstance(error, errext.MissingRequiredArgument): await ctx.send('**Missing required argument**') await u.add_reaction(ctx.message, '\N{CROSS MARK}')