From 3aec94a5cc39b2426e4eac36cfbc61c37c7e524f Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Thu, 22 Sep 2016 20:48:18 -0500 Subject: [PATCH] Corrected how to check for permission errors --- bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index e700b06..2f63b0c 100644 --- a/bot.py +++ b/bot.py @@ -97,8 +97,12 @@ async def on_message(message): async def on_command_error(error, ctx): if isinstance(error, commands.CommandNotFound): return - if error.original and isinstance(error.original, discord.Forbidden): - return + try: + if isinstance(error.original, discord.Forbidden): + return + except AttributeError: + pass + if isinstance(error, commands.BadArgument): fmt = "Please provide a valid argument to pass to the command: {}".format(error) await bot.send_message(ctx.message.channel, fmt)