Config As An Argument
This commit is contained in:
parent
90b3683beb
commit
9b15565051
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue