Initial implementation of the bot

This commit is contained in:
Tristan Daniël Maat 2023-05-19 19:46:11 +01:00
commit aec9047998
Signed by: tlater
GPG key ID: 49670FD774E43268
8 changed files with 427 additions and 0 deletions

36
src/main.py Normal file
View file

@ -0,0 +1,36 @@
"""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)