Fix on_command_error for extension and purge
This commit is contained in:
parent
3f9da28d05
commit
eca068c670
2 changed files with 4 additions and 2 deletions
|
@ -55,7 +55,8 @@ class Extension(commands.Cog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_command_error(self, ctx: commands.Context, error):
|
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):
|
if isinstance(error, NotOwner):
|
||||||
await ctx.message.add_reaction("\u274C")
|
await ctx.message.add_reaction("\u274C")
|
||||||
elif isinstance(error, CommandNotFound):
|
elif isinstance(error, CommandNotFound):
|
||||||
|
|
|
@ -58,7 +58,8 @@ class Purge(commands.Cog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_command_error(self, ctx: commands.Context, error):
|
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):
|
if isinstance(error, CommandNotFound):
|
||||||
await ctx.message.add_reaction("\u2753")
|
await ctx.message.add_reaction("\u2753")
|
||||||
else:
|
else:
|
||||||
|
|
Reference in a new issue