Initial implementation of the bot
This commit is contained in:
commit
aec9047998
8 changed files with 427 additions and 0 deletions
36
src/main.py
Normal file
36
src/main.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue