import argparse import asyncio from .config import load_config from .bot import send_messages from .format import format_alerts from .webhook import run_webhook async def __main(): parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", default="config.yaml") args = parser.parse_args() config = load_config(args.config) alert_queue = asyncio.Queue() message_queue = asyncio.Queue() bot_corout = send_messages( message_queue, config.username, config.homeserver, config.password, config.alert_rooms ) format_corout = format_alerts( alert_queue, message_queue ) webhook_corout = run_webhook( alert_queue, config.host, config.port ) await asyncio.gather( bot_corout, format_corout, webhook_corout ) def main(): asyncio.run(__main()) if __name__ == "__main__": main()