Title: [FEATURE] A function to automatically decide if update.message.reply_text or update.callback_query.edit_message_text will be used. · Issue #2826 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [FEATURE] A function to automatically decide if update.message.reply_text or update.callback_query.edit_message_text will be used. · Issue #2826 · python-telegram-bot/python-telegram-bot
X Title: [FEATURE] A function to automatically decide if update.message.reply_text or update.callback_query.edit_message_text will be used. · Issue #2826 · python-telegram-bot/python-telegram-bot
Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? In some situations, it may not be possible to know if you should use update.message.reply_text or update.callback_query.edit_message_text. This could happen ...
Open Graph Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? In some situations, it may not be possible to know if you should use update.message.reply_text or update.callback_que...
X Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? In some situations, it may not be possible to know if you should use update.message.reply_text or update.callback_que...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/2826
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[FEATURE] A function to automatically decide if update.message.reply_text or update.callback_query.edit_message_text will be used.","articleBody":"### What kind of feature are you missing? Where do you notice a shortcoming of PTB?\n\nIn some situations, it may not be possible to know if you should use update.message.reply_text or update.callback_query.edit_message_text. This could happen if user can start a conversation from different stages of a conversation (where sometimes they are using an inline keyboard and sometimes sending text.) IF it happens, you'll face an exception.\n\n### Describe the solution you'd like\n\nI think it would be useful to have a function in update, that decides automatically if it should use update.message.reply_text or update.callback_query.edit_message_text. This could even be a simple try except block such as this:\r\n\r\n```\r\ndef send_message(update, text, reply_markup=None, parse_mode=None):\r\n \"\"\"\r\n Sends a message to the user.\r\n This will use callback_query.edit_message_text as priority. if it doesn't work, will use message.reply_text instead.\r\n To be used when we're not sure which one will be needed.\r\n \"\"\"\r\n try:\r\n return update.callback_query.edit_message_text(\r\n text, reply_markup=reply_markup, parse_mode=parse_mode\r\n )\r\n except:\r\n return update.message.reply_text(\r\n text, reply_markup=reply_markup, parse_mode=parse_mode\r\n )\r\n```\n\n### Describe alternatives you've considered\n\n_No response_\n\n### Additional context\n\nThis may also an issue for accessing `from_user`, but I haven't checked the docs to see if there is a solution for that or not. ","author":{"url":"https://github.com/evakdev","@type":"Person","name":"evakdev"},"datePublished":"2021-12-24T14:20:49Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/2826"}
| 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:f4b1dcdb-5a7f-fd44-aba9-b27b283f8e9f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8624:44934:8D01DC:B912CA:6B0279B9 |
| html-safe-nonce | 417e9004e17df1eccc507db69e07b9853992263bc02886b1d32a6efff2522b9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjI0OjQ0OTM0OjhEMDFEQzpCOTEyQ0E6NkIwMjc5QjkiLCJ2aXNpdG9yX2lkIjoiODAyODgxOTMzNzcxMTc2Mzc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c6c647c89cc34674864fca13b4301afd2c7e44929451d6dc21d58aa092d0667b |
| hovercard-subject-tag | issue:1088403380 |
| 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/2826/issue_layout |
| twitter:image | https://opengraph.githubassets.com/93726a628e00673b3fda4655cb37f7daef759e0b1398a52c1545e6b86744e6d5/python-telegram-bot/python-telegram-bot/issues/2826 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/93726a628e00673b3fda4655cb37f7daef759e0b1398a52c1545e6b86744e6d5/python-telegram-bot/python-telegram-bot/issues/2826 |
| og:image:alt | What kind of feature are you missing? Where do you notice a shortcoming of PTB? In some situations, it may not be possible to know if you should use update.message.reply_text or update.callback_que... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | evakdev |
| 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