Title: Exit from conversation when a new command is sent · Issue #1447 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Exit from conversation when a new command is sent · Issue #1447 · python-telegram-bot/python-telegram-bot
X Title: Exit from conversation when a new command is sent · Issue #1447 · python-telegram-bot/python-telegram-bot
Description: What I need: Define two conversation handler, conv1 and conv2, with entry points /command1 and /command2: each conversation with multiple states. It should work in this way: a. I enter in conv1 conversation, typing /command1, and I start...
Open Graph Description: What I need: Define two conversation handler, conv1 and conv2, with entry points /command1 and /command2: each conversation with multiple states. It should work in this way: a. I enter in conv1 con...
X Description: What I need: Define two conversation handler, conv1 and conv2, with entry points /command1 and /command2: each conversation with multiple states. It should work in this way: a. I enter in conv1 con...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/1447
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exit from conversation when a new command is sent","articleBody":"### What I need:\r\nDefine two conversation handler, conv1 and conv2, with entry points /command1 and /command2: each conversation with multiple states. It should work in this way:\r\na. I enter in conv1 conversation, typing /command1, and I start to follow the normal conversation. Then, in the middle of conversation, I send /command2 and the first conversation end (Like ConversationHandler.END).\r\nAnd viceversa:\r\nb. I enter in conv2 conversation, typing /command2, and I start to follow the normal conversation. Then, in the middle of conversation, I send /command1 and the first conversation end (Like ConversationHandler.END).\r\nI need that when I start a conversation with the bot I can interrupt it sending a command: in this case the bot end the conversation and answer the new command.\r\n\r\n### Expected behaviour:\r\nThere should be a way to define the conversation handler such that it will handle all the messages sent while the conversation is open.\r\n\r\n### Actual behaviour:\r\nI've found #1365, so I've try to add to conversation handler the following fallbacks:\r\n```\r\ndef cancel(bot, update):\r\n\tupdate.message.reply_text('Operation canceled', reply_markup=markup)\r\n\treturn ConversationHandler.END\r\nconv_handler = ConversationHandler(\r\n\tentry_points=[CommandHandler('command', conv0)],\r\n\tstates={\r\n\t\tCONV: [MessageHandler(Filters.text, conv1)],\r\n\t},\r\n\tfallbacks=[MessageHandler(Filters.command, cancel)],\r\n)\r\n```\r\nIn this way it close conversation if there aren't ConversationHandler/CommandHandler that handle the command send before the ConversationHandler of /command.\r\n\r\n### Configuration:\r\nVersion of Python: 3.6.7\r\nVersion of python-telegram-bot: 11.1.0","author":{"url":"https://github.com/davidegori","@type":"Person","name":"davidegori"},"datePublished":"2019-07-16T20:49:07Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/1447"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e45e5022-df6a-48ab-d000-cdfa21c08d35 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F26:3C1EC:15C01:1BEDA:6B028792 |
| html-safe-nonce | 8c511bd1bd44663218d8ecd85784161f4e05c9aaa80e7ff9c10d5f56cda7d950 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjI2OjNDMUVDOjE1QzAxOjFCRURBOjZCMDI4NzkyIiwidmlzaXRvcl9pZCI6IjE2Njg1OTYyMjY1MTU0Mzc0NTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 418894943ff67e6742bfdd0461e7bfd1c721bb0a52ae717e3f875d99ce5e0697 |
| hovercard-subject-tag | issue:468856789 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-telegram-bot/python-telegram-bot/1447/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a42436b9f0652f70183e90eb6679c4a162e86e7e837e2adc22aea674aa9384f0/python-telegram-bot/python-telegram-bot/issues/1447 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a42436b9f0652f70183e90eb6679c4a162e86e7e837e2adc22aea674aa9384f0/python-telegram-bot/python-telegram-bot/issues/1447 |
| og:image:alt | What I need: Define two conversation handler, conv1 and conv2, with entry points /command1 and /command2: each conversation with multiple states. It should work in this way: a. I enter in conv1 con... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidegori |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width