1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

Починка статусов в ботов5

This commit is contained in:
MoonTestUse1
2024-12-26 04:27:20 +06:00
parent 3a8d996975
commit fbb0729f90
2 changed files with 30 additions and 25 deletions

View File

@@ -1,18 +1,19 @@
"""Bot initialization module"""
from aiogram import Bot, Dispatcher
from .config import settings
from .handlers import callbacks_router, start_router
# Initialize bot and dispatcher
bot = Bot(token=settings.bot_token)
dp = Dispatcher()
# Include routers only once during initialization
dp.include_router(callbacks_router)
dp.include_router(start_router)
async def start_bot():
"""Start the bot and include all routers"""
from .handlers import callbacks_router, start_router
# Include routers
dp.include_router(callbacks_router)
dp.include_router(start_router)
# Start polling
await dp.start_polling(bot, skip_updates=True)
"""Start the bot"""
try:
await dp.start_polling(bot, skip_updates=True)
except Exception as e:
print(f"Error starting bot: {e}")