Config As An Argument

This commit is contained in:
Casey 2024-07-07 23:41:38 +03:00
parent 90b3683beb
commit 9b15565051
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 5 additions and 3 deletions

View File

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