From 8184a8654b8522106e6973b033a003f63ad116bf Mon Sep 17 00:00:00 2001 From: Lewis B Date: Thu, 10 Oct 2019 10:43:22 +1000 Subject: [PATCH] Unknown command --- uqcsbot/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/uqcsbot/base.py b/uqcsbot/base.py index b721a6fa..8eeddefb 100644 --- a/uqcsbot/base.py +++ b/uqcsbot/base.py @@ -193,8 +193,12 @@ def _handle_command(self, message: dict) -> None: command = Command.from_message(message) if command is None: return - for handler in self._command_registry[command.name]: - self.executor.submit(self._execute_catching_error, handler, command) + handlers = self._command_registry[command.name] + if not handlers: + self.post_message(command.channel_id, "Unknown command. Use !help to retrieve a list of supported commands") + else: + for handler in self._command_registry[command.name]: + self.executor.submit(self._execute_catching_error, handler, command) def _run_handlers(self, event: dict): """