Title: [FEATURE] add ConversationHandler state to CallbackContext · Issue #2331 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [FEATURE] add ConversationHandler state to CallbackContext · Issue #2331 · python-telegram-bot/python-telegram-bot
X Title: [FEATURE] add ConversationHandler state to CallbackContext · Issue #2331 · python-telegram-bot/python-telegram-bot
Description: Is your feature request related to a problem? Please describe. While using ConversationHandler there is no possibility to check which state a callback was triggered from. In my case I have a bot for a group game and I have commands like ...
Open Graph Description: Is your feature request related to a problem? Please describe. While using ConversationHandler there is no possibility to check which state a callback was triggered from. In my case I have a bot fo...
X Description: Is your feature request related to a problem? Please describe. While using ConversationHandler there is no possibility to check which state a callback was triggered from. In my case I have a bot fo...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/2331
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[FEATURE] add ConversationHandler state to CallbackContext","articleBody":"#### Is your feature request related to a problem? Please describe.\r\nWhile using `ConversationHandler` there is no possibility to check which state a callback was triggered from.\r\n\r\nIn my case I have a bot for a group game and I have commands like `/add_me`, `/remove_me` which every user may trigger at any time during the game. I would like to update my internal state differently depending on which state the conversation is currently in.\r\n\r\n#### Describe the solution you'd like\r\nAs a solution I'd like to see an additional field in `CallbackContext`, e.g. `{\"conversation_data\": {\"current_state\": \u003cMY_STATE>}}`. This can be easily done by implementing `collect_additional_context` method in `ConversationHandler` class.\r\n\r\n#### Describe alternatives you've considered\r\nThere are two ways to achieve what I need using current code:\r\n1. assuming I only has one `ConversationHandler` and it was added to dispatcher first, I can run \r\n ```\r\n context.dispatcher.handlers[0][0].conversations[(update.effective_chat.id,)]\r\n ```\r\n however this method is error-prone if i have many conversation handlers or I have nested ones.\r\n\r\n2. I can manually update context with `conversation_data` field, however this would require editing all of my callbacks and therefore also error-prone.\r\n\r\n#### Additional context\r\nN/A\r\n\r\nI will be happy to make a PR if you find this useful.","author":{"url":"https://github.com/MrTsepa","@type":"Person","name":"MrTsepa"},"datePublished":"2021-01-23T11:52:38Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/2331"}
| 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:de9567cd-e270-1b73-090b-7eafc699fd2e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDE0:28264A:F6D0B8:1456FD2:6B0287A1 |
| html-safe-nonce | 4f9dc065b6e99f9e02e44135d3e7a830f81a50050c97be4185337590b6e247f4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREUwOjI4MjY0QTpGNkQwQjg6MTQ1NkZEMjo2QjAyODdBMSIsInZpc2l0b3JfaWQiOiIzMTMwNTAzMjQwMzc5MTcyNzY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f66562c9773677165ad098607c738f643bb652d104b993ba5798661f05277261 |
| hovercard-subject-tag | issue:792539029 |
| 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/2331/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c6837a6d42b53981964e2efb6c6856061c9358324885f6572b477321d1c870eb/python-telegram-bot/python-telegram-bot/issues/2331 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c6837a6d42b53981964e2efb6c6856061c9358324885f6572b477321d1c870eb/python-telegram-bot/python-telegram-bot/issues/2331 |
| og:image:alt | Is your feature request related to a problem? Please describe. While using ConversationHandler there is no possibility to check which state a callback was triggered from. In my case I have a bot fo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MrTsepa |
| 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