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:
parent
367d0b7986
commit
e23444b757
|
@ -92,11 +92,11 @@ class ExternalBotHandler(object):
|
||||||
def get_config_info(self, bot_name, section=None, optional=False):
|
def get_config_info(self, bot_name, section=None, optional=False):
|
||||||
# type: (str, Optional[str], Optional[bool]) -> Dict[str, Any]
|
# type: (str, Optional[str], Optional[bool]) -> Dict[str, Any]
|
||||||
conf_file_path = os.path.realpath(os.path.join(
|
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
|
section = section or bot_name
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
with open(config_file_path) as conf:
|
with open(conf_file_path) as conf:
|
||||||
config.readfp(conf) # type: ignore
|
config.readfp(conf) # type: ignore
|
||||||
except IOError:
|
except IOError:
|
||||||
if optional:
|
if optional:
|
||||||
|
|
Loading…
Reference in a new issue