zulip_botserver: Better message for single bot mode.
This commit is contained in:
parent
b119d67182
commit
a5d6286d85
|
@ -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]]:
|
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)
|
parser = parse_config_file(config_file_path)
|
||||||
|
|
||||||
bots_config = {}
|
bots_config = {} # type: Dict[str, Dict[str, str]]
|
||||||
for section in parser.sections():
|
for section in parser.sections():
|
||||||
section_info = {
|
section_info = {
|
||||||
"email": parser.get(section, 'email'),
|
"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'),
|
"site": parser.get(section, 'site'),
|
||||||
}
|
}
|
||||||
if bot_name is not None:
|
if bot_name is not None:
|
||||||
bots_config[bot_name] = section_info
|
logging.warning("Single bot mode is enabled")
|
||||||
logging.warning("First bot name in the config list was changed to '{}'. "
|
if bots_config:
|
||||||
"Other bots will be ignored".format(bot_name))
|
logging.warning("'{}' bot will be ignored".format(section))
|
||||||
return bots_config
|
else:
|
||||||
bots_config[section] = section_info
|
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
|
return bots_config
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue