Fix text dialog routing and club card registration recovery
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
19
src/handlers/input_fallback.py
Normal file
19
src/handlers/input_fallback.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""Explain unmatched input instead of silently dropping it or broadcasting it."""
|
||||
from aiogram import F, Router
|
||||
from aiogram.fsm.context import FSMContext
|
||||
from aiogram.types import Message
|
||||
|
||||
input_fallback_router = Router(name="input_fallback")
|
||||
|
||||
|
||||
@input_fallback_router.message(F.text.lstrip().startswith("/"))
|
||||
async def unknown_command(message: Message):
|
||||
await message.answer("Команда не распознана или недоступна на этом шаге. /help — справка, /cancel — отменить текущий ввод.")
|
||||
|
||||
|
||||
@input_fallback_router.message()
|
||||
async def unmatched_input(message: Message, state: FSMContext):
|
||||
if await state.get_state():
|
||||
await message.answer("Этот ввод не подходит для текущего шага. Отправьте данные в формате из подсказки или используйте предложенные кнопки. /cancel — отмена.")
|
||||
else:
|
||||
await message.answer("Сейчас бот не ожидает эти данные. /start — главное меню, /register — регистрация. Для переписки сначала откройте чат.")
|
||||
Reference in New Issue
Block a user