Fix config file not reloading on bot restart

This commit is contained in:
Joscha 2019-04-19 09:57:09 +00:00
parent d9f25a04fb
commit de4ba53de8
2 changed files with 9 additions and 8 deletions

View file

@ -3,6 +3,7 @@
## Next version
- add timeout for creating ws connections
- fix config file not reloading when restarting bots
## 1.1.2 (2019-04-14)

View file

@ -54,12 +54,12 @@ def run(
bot_constructor: BotConstructor,
config_file: str = "bot.conf",
) -> None:
async def _run() -> None:
while True:
# Load the config file
config = configparser.ConfigParser(allow_no_value=True)
config.read(config_file)
async def _run() -> None:
while True:
bot = bot_constructor(config, config_file)
await bot.run()
@ -70,12 +70,12 @@ def run_modulebot(
module_constructors: Dict[str, ModuleConstructor],
config_file: str = "bot.conf",
) -> None:
async def _run() -> None:
while True:
# Load the config file
config = configparser.ConfigParser(allow_no_value=True)
config.read(config_file)
async def _run() -> None:
while True:
modulebot = modulebot_constructor(config, config_file,
module_constructors)
await modulebot.run()