Title: Proposal/WIP: InlineMenuHandler by Bibo-Joshi · Pull Request #1702 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Proposal/WIP: InlineMenuHandler by Bibo-Joshi · Pull Request #1702 · python-telegram-bot/python-telegram-bot
X Title: Proposal/WIP: InlineMenuHandler by Bibo-Joshi · Pull Request #1702 · python-telegram-bot/python-telegram-bot
Description: While working on my personal bot, I found building menus with InlineKeyboardMarkups to be somewhat tiresome sometimes. You have to build a lot of InlineKeyboardButtons, add a lot of CallbackQueryHandlers to your ConversationHandler and keep the overview in the process. This is an attempt to build a more user friendly handler as "wrapper" on top of the ConversationHandler for creating menus. For each state only the following information is needed: A message text An array of (button_label, next_state)-type tuples optionally a callback to handle the user input All the labels/text may also be replaced by a callback to adjust the texts according to the user input, but that is optional. A InlineMenuHandler could look like this: InlineMenuHandler( name = 'imh', start_command='start', parse_mode='Markdown', menus = { InlineMenuHandler.MAIN_MENU : ( '*Menu 1:* _Top Level Menu_', [ [('1.1', '1.1'), ('1.1', '1.1')], [('1.2', '1.2'), ('1.2', '1.2')] ] ), '1.1': ( '*Menu 1.1:* _One Of Two Lower Level Menus_', [ [('1', InlineMenuHandler.MAIN_MENU), ('1.2', '1.2')] ] ), '1.2': ( description_callback, [ [('1', InlineMenuHandler.MAIN_MENU), ('End', ConversationHandler.END)] ], parse_input_callback ), ConversationHandler.END: ( 'The conversation ends here. Bye' ) }, fallbacks = [CommandHandler('cancel', fallback)] ) Especially for menus that need little processing of the user input, I hope that this is easier to maintain than a full grown ConversationHandler. I'm aware that such a new feature will needs thorough discussion, may well be rejected and also that we have other issues to discuss in dev chat :D Still, I wanted to put it out here.
Open Graph Description: While working on my personal bot, I found building menus with InlineKeyboardMarkups to be somewhat tiresome sometimes. You have to build a lot of InlineKeyboardButtons, add a lot of CallbackQueryHa...
X Description: While working on my personal bot, I found building menus with InlineKeyboardMarkups to be somewhat tiresome sometimes. You have to build a lot of InlineKeyboardButtons, add a lot of CallbackQueryHa...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/pull/1702
X: @github
Domain: github.com
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:5e7249ed-51a8-4dfc-ddc6-4d2da6d36ee2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DB1E:26ECEB:50B71E8:664B7DE:6B025FD8 |
| html-safe-nonce | 4cea77ce09d6f5b9564ca29a63cbe44443f5c9e7e8556d53090e4ac4005968a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjFFOjI2RUNFQjo1MEI3MUU4OjY2NEI3REU6NkIwMjVGRDgiLCJ2aXNpdG9yX2lkIjoiNjQ5NTA4NDAyMTk1NjEwODI0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 10f8a01aebabdbf29856eeaa3225b2d6ba1ef532080d3f770839c3ac862c8592 |
| hovercard-subject-tag | pull_request:362305018 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python-telegram-bot/python-telegram-bot/pull/1702/files |
| twitter:image | https://avatars.githubusercontent.com/u/22366557?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/22366557?s=400&v=4 |
| og:image:alt | While working on my personal bot, I found building menus with InlineKeyboardMarkups to be somewhat tiresome sometimes. You have to build a lot of InlineKeyboardButtons, add a lot of CallbackQueryHa... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| 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 |
Links:
Viewport: width=device-width