From 333a3d4a62991c45e8681647c81d8e5ab47e12a0 Mon Sep 17 00:00:00 2001 From: JelNiSlaw Date: Wed, 7 Dec 2022 20:34:44 +0100 Subject: [PATCH] Add custom error text for CommandNotFound --- wulkabot/bot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wulkabot/bot.py b/wulkabot/bot.py index 301a8a3..f550e53 100644 --- a/wulkabot/bot.py +++ b/wulkabot/bot.py @@ -12,7 +12,7 @@ class Wulkabot(commands.Bot): def __init__(self) -> None: super().__init__( command_prefix=commands.when_mentioned_or("!"), - help_command=commands.MinimalHelpCommand(), + help_command=None, intents=discord.Intents(guilds=True, messages=True, message_content=True), allowed_mentions=discord.AllowedMentions.none(), ) @@ -27,7 +27,10 @@ class Wulkabot(commands.Bot): async def on_command_error( self, context: commands.Context, exception: commands.errors.CommandError, / ) -> None: - await context.send(f"Error! {exception}") + if isinstance(exception, commands.CommandNotFound): + await context.send("Taka komenda nie istnieje. Być może chcesz użyć jej wersji z `/`") + else: + await context.send(str(exception)) async def close(self) -> None: await super().close()