Description
Issue I am facing
Hi, I have faced a problem where I have a few conversations and a few commands:
dp.add_handler(
ConversationHandler(
entry_points=[CommandHandler('command1', command1)],
states={
STATE1: [MessageHandler(Filters.text, do_something1)],
},
fallbacks=[AnyHandler(do_something1_fallback)],
allow_reentry=True,
)
)
dp.add_handler(CommandHandler('command2', command2))
dp.add_handler(
ConversationHandler(
entry_points=[CommandHandler('command3, command3)],
states={
STATE2: [MessageHandler(Filters.video, do_something3)],
},
fallbacks=[AnyHandler(do_something3_fallback)],
allow_reentry=True,
)
)
dp.add_handler(AnyHandler(global_fallback))
Now when my bot handles conversation for command3
, I can easy to interrupt the conversation by entering command2 or command3. But interruption doesn't reset state of conversation for command3.
For example:
U: /command3
B: Send video
U: (sends a text)
B: Send video, please
U: /command1
B: Send text
U: (sends a text)
B: Thanks, I saved it
U: BLABLA
B: Send video, please.
The last sentence is not obvious, why I need a video (do_something3_fallback) when I finished the conversation in the middle of full conversational? More generaly I expect to see the result of global_fallback
.
My idea to add a parameter isolated
to conversational that doesn't allow interruption by any command and when such conversational started than dispatcher can only view handlers of started conversation.
I know that I can implement it by nesting Conversational Handlers, but then my code looks very ugly and messy.