This commit fixes a critical bug where the bot would get stuck in previous conversational flows and provide incorrect responses.

The /start command handler in main.py now explicitly calls flow_engine.end_flow() to clear any existing conversation state for the user.

This ensures that every /start command provides a clean slate, resolving the state management issue and making the bot's interactions predictable and correct.
This commit is contained in:
google-labs-jules[bot]
2025-12-21 18:23:53 +00:00
parent 384e23cf58
commit 3cdc7a73ef

View File

@@ -90,6 +90,13 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
Muestra un mensaje de bienvenida y un menú según el rol del usuario.
"""
chat_id = update.effective_chat.id
# Reset any existing conversation flow
flow_engine = context.bot_data.get("flow_engine")
if flow_engine:
flow_engine.end_flow(chat_id)
logger.info(f"User {chat_id} started a new conversation, clearing any previous state.")
user_role = get_user_role(chat_id)
logger.info(f"Usuario {chat_id} inició conversación con el rol: {user_role}")