fix: fix /start command not working - router order issue
Some checks reported errors
continuous-integration/drone/push Build encountered an error
continuous-integration/drone/pr Build encountered an error

PROBLEM:
- /start command was not responding
- Chat router was intercepting all text messages including commands
- Main router with /start handler was connected AFTER chat_router

ROOT CAUSE:
- chat_router has @router.message(F.text) handler that catches ALL text
- It was connected BEFORE main router with Command('start') handler
- chat_router returned early for /start, preventing main handler from running

SOLUTION:
1. Move main router (with /start, /help, /admin) to FIRST position
2. Keep chat_router LAST (catches only unhandled messages)
3. Remove /start and /help from chat_handlers command list (handled earlier)

ROUTER ORDER (priority):
1. router (main.py) - base commands
2. admin_router - admin panel
3. registration_router
4. admin_account_router
5. admin_chat_router
6. redraw_router
7. account_router
8. chat_router - LAST (catch-all for broadcasts)

ALSO FIXED:
- Add missing imports in admin_panel.py: Lottery, Participation, Account
- Fixes NameError crashes in cleanup functions
This commit is contained in:
2025-11-17 06:56:50 +09:00
parent 72e95db811
commit 0dc0ae8111
3 changed files with 11 additions and 8 deletions

View File

@@ -15,7 +15,7 @@ import json
from ..core.database import async_session_maker
from ..core.services import UserService, LotteryService, ParticipationService
from ..core.config import ADMIN_IDS
from ..core.models import User
from ..core.models import User, Lottery, Participation, Account
# Состояния для админки