Fix text dialog routing and club card registration recovery
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-09-13 21:39:40 +09:00
parent 3c1a6a02a5
commit f3f8d0f737
28 changed files with 788 additions and 334 deletions

13
main.py
View File

@@ -8,7 +8,7 @@ from contextlib import asynccontextmanager
from aiogram import Bot, Dispatcher, Router, F
from aiogram.types import Message, CallbackQuery
from aiogram.filters import Command
from aiogram.filters import Command, StateFilter
from aiogram.fsm.storage.memory import MemoryStorage, SimpleEventIsolation
from aiogram.fsm.storage.redis import RedisStorage, DefaultKeyBuilder
from aiogram.client.session.aiohttp import AiohttpSession
@@ -164,7 +164,7 @@ async def cmd_register(message: Message, state: FSMContext):
await btn_registration(message, state)
@router.message(F.text.lower().in_(["регистрация", "регистр", "register"]))
@router.message(StateFilter(None), F.text.lower().in_(["регистрация", "регистр", "register"]))
async def text_registration(message: Message, state: FSMContext):
"""Обработчик текста для регистрации"""
await btn_registration(message, state)
@@ -192,9 +192,9 @@ async def btn_help(message: Message):
@router.message(F.text == "⚙️ Админ панель")
async def btn_admin(message: Message):
async def btn_admin(message: Message, state: FSMContext):
"""Обработчик кнопки 'Админ панель'"""
await cmd_admin(message)
await cmd_admin(message, state)
@router.message(F.text == "🚪 Выйти из чата")
@@ -211,7 +211,7 @@ async def btn_main_menu(message: Message, state: FSMContext):
@router.message(CaseInsensitiveCommand("admin"))
async def cmd_admin(message: Message):
async def cmd_admin(message: Message, state: FSMContext):
"""Обработчик команды /admin (регистронезависимо) - перенаправляет в admin_panel"""
from src.core.config import ADMIN_IDS
from src.core.database import async_session_maker
@@ -238,6 +238,7 @@ async def cmd_admin(message: Message):
return
# Отправляем сообщение с кнопкой админ панели
await state.clear()
from src.components.ui import KeyboardBuilderImpl
kb = KeyboardBuilderImpl()
keyboard = kb.get_admin_keyboard()
@@ -329,6 +330,8 @@ def configure_dispatcher():
# 4. Account router для обнаружения счетов (обрабатывает сообщения со счетами от админов)
dp.include_router(account_router) # Обнаружение счетов для админов - ПОСЛЕ chat_router
from src.handlers.input_fallback import input_fallback_router
dp.include_router(input_fallback_router)