start
This commit is contained in:
25
bot/main.py
Normal file
25
bot/main.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from aiogram import Bot, Dispatcher
|
||||
import asyncio
|
||||
import logging
|
||||
from bot.config import config
|
||||
from bot.handlers import router as main_router
|
||||
|
||||
async def main():
|
||||
# Настройка логирования
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
# Инициализация бота и диспетчера
|
||||
bot = Bot(token=config.BOT_TOKEN)
|
||||
dp = Dispatcher()
|
||||
|
||||
# Регистрация роутеров (хендлеров)
|
||||
dp.include_router(main_router)
|
||||
|
||||
# Запуск polling
|
||||
try:
|
||||
await dp.start_polling(bot)
|
||||
finally:
|
||||
await bot.session.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user