From 2ec5bb7b70ab196113e8f821ea29f5f2912542ae Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sun, 5 Apr 2020 10:50:17 +0000 Subject: [PATCH] minor: Warn about missing usage handlers. --- zulip_bots/zulip_bots/lib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index 55c7e37..2541b81 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -337,7 +337,10 @@ def run_message_handler_for_bot( print("Running {} Bot:".format(bot_details['name'])) if bot_details['description'] != "": print("\n\t{}".format(bot_details['description'])) - print(message_handler.usage()) + if hasattr(message_handler, 'usage'): + print(message_handler.usage()) + else: + print('WARNING: {} is missing usage handler, please add one eventually'.format(bot_name)) def handle_message(message: Dict[str, Any], flags: List[str]) -> None: logging.info('waiting for next message')