diff --git a/async-bot.py b/async-bot.py index f83f192..2e2c3b4 100644 --- a/async-bot.py +++ b/async-bot.py @@ -263,6 +263,7 @@ class AsyncBotManager: await sio.emit("toggle_bit", {"index": index}) await asyncio.sleep(delay) self._active.add(bot_index) + break with suppress(BaseException): await sio.receive(0.1) print(f"Worker {bot_index} stopped: shutdown") @@ -278,8 +279,8 @@ class AsyncBotManager: await self._listener_task -async def amain() -> None: - with open("settings.json", "r") as fp: +async def amain(conf_path: str = "settings.json", *_) -> None: + with open(conf_path, "r") as fp: settings = load(fp) async with AsyncBotManager() as mgr: @@ -434,4 +435,5 @@ async def amain() -> None: if __name__ == "__main__": - asyncio.run(amain(), debug=True) + from sys import argv + asyncio.run(amain(argv[1:]), debug=True)