-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (18 loc) · 829 Bytes
/
main.py
File metadata and controls
28 lines (18 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import asyncio
from aiogram import Bot, Dispatcher
from config_data.config import Config, load_config
from handlers import other_handlers, user_handlers
# Функция конфигурирования и запуска бота
async def main():
# Загружаем конфиг в переменную config
config: Config = load_config()
# Инициализируем бот
bot = Bot(token=config.tg_bot.token)
dp = Dispatcher()
# Регистриуем роутеры в диспетчере
dp.include_router(user_handlers.router)
dp.include_router(other_handlers.router)
# Пропускаем накопившиеся апдейты и запускаем polling
await bot.delete_webhook(drop_pending_updates=True)
await dp.start_polling(bot)
asyncio.run(main())