fix: fix /start command not working - router order issue
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:
@@ -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
|
||||
|
||||
|
||||
# Состояния для админки
|
||||
|
||||
Reference in New Issue
Block a user