Skip to content

Commit

Permalink
Add notify command
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob committed Feb 19, 2024
1 parent 2587f31 commit 6ac80b7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions aeza_assistant/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Main entry point for the bot."""

from asyncio import get_event_loop
from asyncio import get_event_loop, sleep
from logging import basicConfig
from os import environ
from sys import argv, exit
from json import loads

from aiohttp import ClientSession

Expand Down Expand Up @@ -39,8 +40,17 @@ async def main_async() -> None:

if argv[1] == "run":
await bot.run()
elif argv[1] == "notify":
statuses = loads(argv[2])
async with bot.cron.maker() as db:
await bot.cron.send_notification(db, statuses)
await bot.task_queue.start()
while True:
await sleep(1)
if bot.task_queue.queue.empty():
break
else:
print("Usage: python -m bot [run]")
print("Usage: python -m bot [run|notify]")
exit(1)


Expand Down

0 comments on commit 6ac80b7

Please sign in to comment.