Title: [Discussion:] ConversationHandler · Issue #2770 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [Discussion:] ConversationHandler · Issue #2770 · python-telegram-bot/python-telegram-bot
X Title: [Discussion:] ConversationHandler · Issue #2770 · python-telegram-bot/python-telegram-bot
Description: Several ideas for changes and/or additions have been gathered in the v14 project, mentioned in the user group or issues or dwelled in the back of my head. So I'm writing this issue to keep track of them better. The following list of idea...
Open Graph Description: Several ideas for changes and/or additions have been gathered in the v14 project, mentioned in the user group or issues or dwelled in the back of my head. So I'm writing this issue to keep track of...
X Description: Several ideas for changes and/or additions have been gathered in the v14 project, mentioned in the user group or issues or dwelled in the back of my head. So I'm writing this issue to keep trac...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/2770
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Discussion:] ConversationHandler","articleBody":"Several ideas for changes and/or additions have been gathered in the v14 project, mentioned in the user group or issues or dwelled in the back of my head. So I'm writing this issue to keep track of them better.\r\n\r\nThe following list of ideas should be discussed before release of v14 because at least some of them are easier to implement if we do them non-backwards compatible. I'd like to emphasize that most of these are very rough first thoughts and I'm fully aware that we may scrape many of them.\r\n\r\nRelated: https://github.com/python-telegram-bot/python-telegram-bot/discussions/2802\r\n\r\n---\r\n\r\n* Make `CH.fallbacks` optional. I've seen a lot of people (including me) setting at to an empty list for some use cases … Poolitzer already expressed support for this idea\r\n* ~ConverstanionHandler + run_async: Problem is that we can't persist futures/promises. But we should be able to guarantee that all futures are done on (clean) shutdown. One could add something like `BasePersistence.resolve_conversation_promises` that persistence classes can call before flushing on shutdown.~ This already get's handled on v20\r\n* #2390 (closed just for better overview, not actually implemented)\r\n* add a \"prefallbacks\" list, i.e. the state-handlers only trigger, if the \"prefallback\" handlers don't trigger. The current alternative is to add those handlers to the `fallbacks` list, which requires to make all state handlers ignore updates that should be handled by the `fallbacks`. see also #2764 #2960\r\n* Include `entry_points`, `fallbacks` (and eventual \"prefallbacks\") into the `states` dict. We already have special states for `TIMEOUT` and `WAITING`, so I think it would make the interface cleaner if we used special states `(PRE)FALLBACK` and `END` as keys for these lists rather than making them standalone kwargs of `__init__`\r\n* Think about \"conversation related data\", e.g. `context.conversation_data`. It should be an object unique per conversation key and `ConversationHandler` instance. It may even be automatically deleted when the conversation ends . See also #4136\r\n* Rethink which parts of `ConversationHandler` we consider public.\r\n * e.g. the `conversations` is currently public, although undocumented and basically part of the internals. If we make it private, we can rework the setters of `persistence` and `conversations` to something like `get_persisted_data(persistence)` or `initialize_persistence(persistence)`\r\n * We also rather regularly get questions like \"how do I access the current state of the conversation\" and \"how do I check if a user has an active conversation\". Making the logic of how the keys are build and how `conversations` works public *may* help with some of these and also with the above `context.conversation_data`\r\n * One could take this one step further and let the user customize how the key is generated. This could be useful e.g. in situations where one wants to handle 3rd-party updates (e.g. login into an external service) within the conversation, which are not of type `telegram.Update`. see also #4768 for a request to make the CH state per message thread ID\r\n* think about `conversation_timeout`:\r\n * Is it worth to allow timeout handlers to put the conversation in a non-end state?\r\n * it it worth to try & allow a different timeout duration per state?\r\n * Can we make them work for nested conversations?\r\n * Can we ensure that the timeout jobs can be persisted?\r\n* #2827 to make CH be based more on a class-like structure\r\n* nested conversations:\r\n * Check behavior of the `WATING` state, especially with nested conversations\r\n * Check behavior of async handlers with nested conversations\r\n * Once a child conversation has started one may want the next update to be processed exclusively by that child conversation, even if it's not the first handler in the state. Maybe this can be made possible. See also https://stackoverflow.com/questions/78143788\r\n* Think about a mechanism to lazy-load persisted conversation states to allow to reduce load on startup. would be especially useful for stateless server designs. See [here](https://t.me/pythontelegrambotgroup/558187) for some initial discussion. Note also that in stateless setups, a `refresh_conversation_data` would be useful, see #4452.\r\n* When the conversation has ended, pass `CH.END` to `persistence.update_conversation` instead of `None`\r\n* We currently issue a warning for `per_message=True, per_chat=False` - this is not necessarily valid in case `inline_message_ids` are used\r\n* `entry_points` should be checked *after* the states are checked - that way, state handlers may trigger before any `entry_points` trigger via `allow_reentry`. See https://t.me/pythontelegrambotgroup/606782?thread=606781 for a question on that. Edit: On second thought, the `allow_reentry` may not be needed at all - the user can just repeat the `entry_points` in the `fallbacks`. If \"prefallbacks\" (see above) are added, that even allows the user to customize which of state handlers and `entry_points` are checked first\r\n* A commonly requested feature is to track a \"conversation\" between two (or more) users who each chat with the bot in the respective private chat. If we could make something like this feasible, that would be awesome.\r\n* discuss possibility to make job timeouts persistent: #3522 \r\n* Improve type hinting where possible - see #3665 (closed only to track this here)\r\n* Errors in the timeout state should be handled like errors in handlers, not like errors in jobs - see https://t.me/pythontelegrambotgroup/675226\r\n* In case built-in states are used, they should either not be easy to reproduce or we should warn if the user tries to use them manually. See https://github.com/python-telegram-bot/python-telegram-bot/issues/3834\r\n* Rethink if we want to allow for some error handling on CH or even state level. See #2277 for some discussion ","author":{"url":"https://github.com/Bibo-Joshi","@type":"Person","name":"Bibo-Joshi"},"datePublished":"2021-11-07T10:33:08Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/2770"}
| 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:2eec3287-82b5-2c96-3ab3-b9481d6b8d01 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFD6:34CAB:4D92B33:62D82CE:6B0279D3 |
| html-safe-nonce | 3f090e0bd7fea164139cfbd855605c13f0bd2625840b615e4414cb6c59eac8ea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkQ2OjM0Q0FCOjREOTJCMzM6NjJEODJDRTo2QjAyNzlEMyIsInZpc2l0b3JfaWQiOiIzNzMwNDc4Njg1MjI1MTIyMjU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bc45828f6f72f3778489d8772c5aa01dfd3fc1f0e95dd1f97b2d3e506f13242e |
| hovercard-subject-tag | issue:1046711967 |
| 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/2770/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0f9f9fb8e153d5067dc1229b9d6cec28976ad4e26084c8dd5ccdde4ae9e80cf1/python-telegram-bot/python-telegram-bot/issues/2770 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0f9f9fb8e153d5067dc1229b9d6cec28976ad4e26084c8dd5ccdde4ae9e80cf1/python-telegram-bot/python-telegram-bot/issues/2770 |
| og:image:alt | Several ideas for changes and/or additions have been gathered in the v14 project, mentioned in the user group or issues or dwelled in the back of my head. So I'm writing this issue to keep track of... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Bibo-Joshi |
| 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