bots: Fix errors to get info from config file to run bots.

get_config_info function in 'ExternalBotHandler' class was
using 2 undefined variables, which wasn't allowing bots to
access information from config file.
Fixed it, bots with api key working now.
This commit is contained in:
Abhijeet Kaur 2017-07-24 02:15:20 +05:30
parent 367d0b7986
commit e23444b757

View file

@ -92,11 +92,11 @@ class ExternalBotHandler(object):
def get_config_info(self, bot_name, section=None, optional=False):
# type: (str, Optional[str], Optional[bool]) -> Dict[str, Any]
conf_file_path = os.path.realpath(os.path.join(
our_dir, 'bots', bot_name, bot_name + '.conf'))
'zulip_bots', 'bots', bot_name, bot_name + '.conf'))
section = section or bot_name
config = configparser.ConfigParser()
try:
with open(config_file_path) as conf:
with open(conf_file_path) as conf:
config.readfp(conf) # type: ignore
except IOError:
if optional: