1
0
Fork 0

Fix on_command_error for extension and purge

This commit is contained in:
Ethanell 2020-04-09 14:08:30 +02:00
parent 3f9da28d05
commit eca068c670
2 changed files with 4 additions and 2 deletions

View file

@ -55,7 +55,8 @@ class Extension(commands.Cog):
@commands.Cog.listener()
async def on_command_error(self, ctx: commands.Context, error):
if ctx.invoked_with == extension_name:
if ctx.invoked_with == extension_name or \
(ctx.command.root_parent is not None and ctx.command.root_parent.name == extension_name):
if isinstance(error, NotOwner):
await ctx.message.add_reaction("\u274C")
elif isinstance(error, CommandNotFound):

View file

@ -58,7 +58,8 @@ class Purge(commands.Cog):
@commands.Cog.listener()
async def on_command_error(self, ctx: commands.Context, error):
if ctx.invoked_with == extension_name:
if ctx.invoked_with == extension_name or \
(ctx.command.root_parent is not None and ctx.command.root_parent.name == extension_name):
if isinstance(error, CommandNotFound):
await ctx.message.add_reaction("\u2753")
else: