From f56f824676e93d01c9159c186cb4161d31ba18a0 Mon Sep 17 00:00:00 2001 From: LoopThrough-i-j Date: Thu, 4 Mar 2021 01:33:14 +0530 Subject: [PATCH] zulip-bots: Replace `ExternalBotHandler` type by `BotHandler`. The functions `extract_query_without_mention` and `is_private_message_but_not_group_pm` now accept `BotHandler` instead of `ExternalBotHandler` which allows passing objects of both `EmbeddedBotHandler` and `ExternalBotHandler`. Fixes #639 --- zulip_bots/zulip_bots/lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index 511f4ed..dc68754 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -295,7 +295,7 @@ class ExternalBotHandler: sys.exit(message) -def extract_query_without_mention(message: Dict[str, Any], client: ExternalBotHandler) -> Optional[str]: +def extract_query_without_mention(message: Dict[str, Any], client: BotHandler) -> Optional[str]: """ If the bot is the first @mention in the message, then this function returns the stripped message with the bot's @mention removed. Otherwise, it returns None. @@ -314,7 +314,7 @@ def extract_query_without_mention(message: Dict[str, Any], client: ExternalBotHa return None -def is_private_message_but_not_group_pm(message_dict: Dict[str, Any], current_user: ExternalBotHandler) -> bool: +def is_private_message_but_not_group_pm(message_dict: Dict[str, Any], current_user: BotHandler) -> bool: """ Checks whether a message dict represents a PM from another user.