feat(*): init
This commit is contained in:
33
backend/src/bot/__init__.py
Normal file
33
backend/src/bot/__init__.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
|
||||
from rich import traceback
|
||||
|
||||
from utils.logging import logger, setup_logging
|
||||
|
||||
setup_logging()
|
||||
|
||||
|
||||
async def runner() -> None:
|
||||
from . import handlers # noqa: PLC0415
|
||||
from .common import bot, dp # noqa: PLC0415
|
||||
|
||||
dp.include_routers(handlers.router)
|
||||
|
||||
await bot.delete_webhook(drop_pending_updates=True)
|
||||
await dp.start_polling(bot)
|
||||
|
||||
|
||||
def plugins() -> None:
|
||||
traceback.install(show_locals=True)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
plugins()
|
||||
|
||||
logger.info("Starting...")
|
||||
|
||||
with contextlib.suppress(KeyboardInterrupt):
|
||||
asyncio.run(runner())
|
||||
|
||||
logger.info("[red]Stopped.[/]")
|
||||
Reference in New Issue
Block a user