Title: [FEATURE] Adding multiple handlers at one · Issue #2821 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [FEATURE] Adding multiple handlers at one · Issue #2821 · python-telegram-bot/python-telegram-bot
X Title: [FEATURE] Adding multiple handlers at one · Issue #2821 · python-telegram-bot/python-telegram-bot
Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? Calling add_handler multiple times maybe become tedious, so this proposes a new method to add multiple handlers at once. Describe the solution you'd like A n...
Open Graph Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? Calling add_handler multiple times maybe become tedious, so this proposes a new method to add multiple handlers at on...
X Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? Calling add_handler multiple times maybe become tedious, so this proposes a new method to add multiple handlers at on...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/2821
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[FEATURE] Adding multiple handlers at one","articleBody":"### What kind of feature are you missing? Where do you notice a shortcoming of PTB?\n\nCalling `add_handler` multiple times maybe become tedious, so this proposes a new method to add multiple handlers at once.\n\n### Describe the solution you'd like\n\nA new method `Dispatcher.add_handlers` (trailing `s`!) with the following syntax:\r\n\r\n```python\r\ndispatcher.add_handlers(list/sequence_of_handlers, group)\r\n```\r\n\r\nshould be a substitute for\r\n\r\n```python\r\nfor handler in list_of_handlers:\r\n dispatcher.add_handler(handler, group=group)\r\n```\r\nand\r\n```python\r\ndispatcher.add_handler({1: [list_1], 2: [list_2]})\r\n```\r\nshould be a shortcut for\r\n```python\r\nfor group, handlers in my_dict.items():\r\n for handler in handlers:\r\n dispatcher.add_handler(handler, group=group)\r\n```\r\nPassing the `group` argument in this case should throw a `ValueError`\n\n### Describe alternatives you've considered\n\n-\n\n### Additional context\n\nProposed in #2813\r\n\r\nIf you are interested in PRing for this, please leave a comment here.\r\nFor the tests to add, you can get inspiration e.g. [here](https://github.com/python-telegram-bot/python-telegram-bot/blob/d064a5d8137d73cc814e3a2f77334b162f5a2844/tests/test_dispatcher.py#L407-L414).","author":{"url":"https://github.com/Bibo-Joshi","@type":"Person","name":"Bibo-Joshi"},"datePublished":"2021-12-16T19:43:21Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/2821"}
| 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:db58fe78-1356-88fb-99c4-6c2603a0bb15 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3F4:148EE1:1AF32F8:21CE8AF:6B027A26 |
| html-safe-nonce | 2992f4784331b724845941ffaff337b7145c9ee8ed74997ce75144edb45951dd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0Y0OjE0OEVFMToxQUYzMkY4OjIxQ0U4QUY6NkIwMjdBMjYiLCJ2aXNpdG9yX2lkIjoiMjAzMzAyOTk4NjkwMTk4MTczNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f9ab74b31c00eba314afc45d0a2a076db2a784f544b1cdf80448fdb75390292c |
| hovercard-subject-tag | issue:1082583177 |
| 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/2821/issue_layout |
| twitter:image | https://opengraph.githubassets.com/326b4021d73999dbc493842aaa1e1521accc69921ad50a6efa140923329cc6dd/python-telegram-bot/python-telegram-bot/issues/2821 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/326b4021d73999dbc493842aaa1e1521accc69921ad50a6efa140923329cc6dd/python-telegram-bot/python-telegram-bot/issues/2821 |
| og:image:alt | What kind of feature are you missing? Where do you notice a shortcoming of PTB? Calling add_handler multiple times maybe become tedious, so this proposes a new method to add multiple handlers at on... |
| 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