/
almaz8811
/
PythonHelper
Обзор
Документация
Войти
/
almaz8811
/
PythonHelper
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
stepik/aiogram/modular_echo_bot/bot.py
23 строки
895 B
almaz
aiogram обычные кнопки
10 июл 2023, 01:31
10 июл 2023, 01:31
f1494ea
Код
Авторство
О чём код?
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 = Bot(token=config.tg_bot.token) dp: Dispatcher = 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) if __name__ == '__main__': asyncio.run(main())