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 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)
|
||||||
|
|
Loading…
Reference in New Issue