mirror of
https://github.com/wasrusgen/zov-tech.git
synced 2026-06-03 21:44:48 +00:00
38 lines
924 B
Python
38 lines
924 B
Python
import asyncio
|
|
import logging
|
|
|
|
from aiogram import Bot, Dispatcher
|
|
from aiogram.client.default import DefaultBotProperties
|
|
from aiogram.enums import ParseMode
|
|
|
|
from config import load_config
|
|
from handlers import start
|
|
|
|
|
|
async def main() -> None:
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
|
|
)
|
|
|
|
config = load_config()
|
|
bot = Bot(
|
|
token=config.bot_token,
|
|
default=DefaultBotProperties(parse_mode=ParseMode.HTML),
|
|
)
|
|
dp = Dispatcher()
|
|
|
|
dp["config"] = config
|
|
dp.include_router(start.router)
|
|
|
|
if config.use_webhook:
|
|
raise NotImplementedError("Webhook mode будет добавлен после MVP")
|
|
|
|
logging.info("Запуск в режиме polling")
|
|
await bot.delete_webhook(drop_pending_updates=True)
|
|
await dp.start_polling(bot)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|