Skip to content

Instantly share code, notes, and snippets.

@lukyanov
Created December 4, 2018 12:09
Show Gist options
  • Save lukyanov/d7bc7212f54a9a5ea47b84ede8ea84c8 to your computer and use it in GitHub Desktop.
Save lukyanov/d7bc7212f54a9a5ea47b84ede8ea84c8 to your computer and use it in GitHub Desktop.
# Let me add an example.
# So I have set up two handlers:
# 1.
```
command1_handler = ConversationHandler(
entry_points=[CommandHandler(‘command1’, command1)],
states={
COMMAND1_STATE1: [
MessageHandler(Filters.text,
command1_state1)
]
}
)
```
2.
```
command2_handler = ConversationHandler(
entry_points=[CommandHandler(‘command2’, command2)],
states={
COMMAND2_STATE1: [
MessageHandler(Filters.text,
command2_state1)
]
}
)
```
And let’s assume that the function command1_state1 just sends back the text «conversaion1», and the function command2_state1 sends back «conversation2».
Now this is what the interaction with the bot looks like from begining to end for /command1 (the normal case):
user: /command1
bot: You have entered /comman1, now continue the conversation 1.
user: ok, I continue
bot: conversation1
This is the normal flow for conversation2:
user: /command2
bot: You have entered /comman2, now continue the conversation 2
user: ok, I continue
bot: conversaion2
But here is where the issue arises:
user: /command1
bot: You have entered /comman1, now continue the conversation 1.
user: /command2
bot: You have entered /comman2, now continue the conversation 2.
user: ok, I continue
bot: conversation1
You see? The last line comes from the handler of the first conversation. The two conversations now somehow exist together and affect each other.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment