diff --git a/extensions/extension.py b/extensions/extension.py index 26db6b0..be97d44 100644 --- a/extensions/extension.py +++ b/extensions/extension.py @@ -55,13 +55,14 @@ class Extension(commands.Cog): @commands.Cog.listener() async def on_command_error(self, ctx: commands.Context, error): - if isinstance(error, NotOwner): - await ctx.message.add_reaction("\u274C") - elif isinstance(error, CommandNotFound): - await ctx.message.add_reaction("\u2753") - else: - await ctx.send("An error occurred !") - raise error + if ctx.invoked_with == extension_name: + if isinstance(error, NotOwner): + await ctx.message.add_reaction("\u274C") + elif isinstance(error, CommandNotFound): + await ctx.message.add_reaction("\u2753") + else: + await ctx.send("An error occurred !") + raise error def setup(bot): diff --git a/extensions/purge.py b/extensions/purge.py index 5ce6e40..5f1622f 100644 --- a/extensions/purge.py +++ b/extensions/purge.py @@ -71,11 +71,12 @@ class Purge(commands.Cog): @commands.Cog.listener() async def on_command_error(self, ctx: commands.Context, error): - if isinstance(error, CommandNotFound): - await ctx.message.add_reaction("\u2753") - else: - await ctx.send("An error occurred !") - raise error + if ctx.invoked_with == extension_name: + if isinstance(error, CommandNotFound): + await ctx.message.add_reaction("\u2753") + else: + await ctx.send("An error occurred !") + raise error def setup(bot): diff --git a/extensions/speak.py b/extensions/speak.py index af0738b..ff41f6d 100644 --- a/extensions/speak.py +++ b/extensions/speak.py @@ -165,11 +165,12 @@ class Speak(commands.Cog): @commands.Cog.listener() async def on_command_error(self, ctx: commands.Context, error): - if isinstance(error, CommandNotFound): - await ctx.message.add_reaction("\u2753") - else: - await ctx.send("An error occurred !") - raise error + if ctx.invoked_with == extension_name: + if isinstance(error, CommandNotFound): + await ctx.message.add_reaction("\u2753") + else: + await ctx.send("An error occurred !") + raise error def setup(bot):