tlsappointment/src/main.py

37 lines
789 B
Python

"""Simple bot to watch for tlscontact visa slots."""
import asyncio
import logging
import sys
import traceback
from .config import Config
from .matrixbot import MatrixBot
from .tlsappointmentbot import TLSAppointmentBot
logger = logging.getLogger(__name__)
def main():
"""Run the tlsappointment bot."""
logging.basicConfig(level=logging.INFO)
config = Config.from_args()
matrix_bot = MatrixBot(config)
tls_bot = TLSAppointmentBot(matrix_bot, config)
async def stuff():
await asyncio.gather(matrix_bot.run(), tls_bot.run())
asyncio.run(stuff())
if __name__ == "__main__":
try:
main()
except Exception:
logger.critical(traceback.format_exc().strip())
sys.exit(1)
except KeyboardInterrupt:
sys.exit(0)