Skip to content

Commit

Permalink
+ Handle CCommandNoPerm
Browse files Browse the repository at this point in the history
null2264 committed Jul 30, 2021
1 parent 1650dba commit ce56b8e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions exts/events.py
Original file line number Diff line number Diff line change
@@ -188,6 +188,15 @@ async def on_command_error(self, ctx, error):
# If nothing is found. We keep the exception passed to on_command_error.
error = getattr(error, "original", error)

# Errors that should be sent no matter what
# These errors should have `message` already defined
defaultError = (
errors.CCommandAlreadyExists,
commands.BadArgument,
errors.MissingMuteRole,
errors.CCommandNoPerm,
)

if isinstance(error, commands.CommandNotFound) or isinstance(
error, commands.DisabledCommand
):
@@ -207,14 +216,10 @@ async def on_command_error(self, ctx, error):
e = formatMissingArgError(ctx, error)
return await ctx.try_reply(embed=e)

if (
isinstance(error, errors.CCommandAlreadyExists)
or isinstance(error, commands.BadArgument)
or isinstance(error, errors.MissingMuteRole)
):
if isinstance(error, defaultError):
return await ctx.error(str(error))

if isinstance(error, pytz.exceptions.UnknownTimeZoneError):
if isinstance(error, pytz.UnknownTimeZoneError):
ctx.command.reset_cooldown(ctx)
return await ctx.error(
"You can look them up at https://kevinnovak.github.io/Time-Zone-Picker/",

0 comments on commit ce56b8e

Please sign in to comment.