mirror of
https://github.com/marcogll/talia_bot.git
synced 2026-01-13 21:35:19 +00:00
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:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user