From eca068c670669066523eaf1310b29a1ded802922 Mon Sep 17 00:00:00 2001 From: flifloo Date: Thu, 9 Apr 2020 14:08:30 +0200 Subject: [PATCH] Fix on_command_error for extension and purge --- extensions/extension.py | 3 ++- extensions/purge.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/extension.py b/extensions/extension.py index be97d44..cad55bb 100644 --- a/extensions/extension.py +++ b/extensions/extension.py @@ -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): diff --git a/extensions/purge.py b/extensions/purge.py index aa43ab9..0b64a35 100644 --- a/extensions/purge.py +++ b/extensions/purge.py @@ -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: