Files
tgit/app/main.py
T

31 lines
730 B
Python

"""Entry point. For now a stub that idles until stopped; the bot itself lands in #4."""
import asyncio
import logging
import signal
from app import __version__
log = logging.getLogger("tgit")
async def run(stop: asyncio.Event) -> None:
log.info("tgit %s started", __version__)
await stop.wait()
log.info("tgit stopped")
def main() -> None:
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s: %(message)s")
async def _main() -> None:
stop = asyncio.Event()
loop = asyncio.get_running_loop()
for sig in (signal.SIGINT, signal.SIGTERM):
loop.add_signal_handler(sig, stop.set)
await run(stop)
asyncio.run(_main())
import os