From a5d6286d858a1f39642e23e98a59af840845681b Mon Sep 17 00:00:00 2001 From: dkvasov Date: Wed, 16 May 2018 20:16:07 +0300 Subject: [PATCH] zulip_botserver: Better message for single bot mode. --- zulip_botserver/zulip_botserver/server.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/zulip_botserver/zulip_botserver/server.py b/zulip_botserver/zulip_botserver/server.py index d0e0381..3ef302e 100644 --- a/zulip_botserver/zulip_botserver/server.py +++ b/zulip_botserver/zulip_botserver/server.py @@ -18,7 +18,7 @@ available_bots = [] # type: List[str] def read_config_file(config_file_path: str, bot_name: Optional[str]=None) -> Dict[str, Dict[str, str]]: parser = parse_config_file(config_file_path) - bots_config = {} + bots_config = {} # type: Dict[str, Dict[str, str]] for section in parser.sections(): section_info = { "email": parser.get(section, 'email'), @@ -26,11 +26,16 @@ def read_config_file(config_file_path: str, bot_name: Optional[str]=None) -> Dic "site": parser.get(section, 'site'), } if bot_name is not None: - bots_config[bot_name] = section_info - logging.warning("First bot name in the config list was changed to '{}'. " - "Other bots will be ignored".format(bot_name)) - return bots_config - bots_config[section] = section_info + logging.warning("Single bot mode is enabled") + if bots_config: + logging.warning("'{}' bot will be ignored".format(section)) + else: + bots_config[bot_name] = section_info + logging.warning( + "First bot name in the config list was changed from '{}' to '{}'".format(section, bot_name) + ) + else: + bots_config[section] = section_info return bots_config