Title: [FEATURE] Switch `filters` to kwarg in `MessageHandler` · Issue #3394 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [FEATURE] Switch `filters` to kwarg in `MessageHandler` · Issue #3394 · python-telegram-bot/python-telegram-bot
X Title: [FEATURE] Switch `filters` to kwarg in `MessageHandler` · Issue #3394 · python-telegram-bot/python-telegram-bot
Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? The filters argument of the MessageHandler constructor is currently a positional argument and defaults to filters.ALL if None is explicitly passed: python-te...
Open Graph Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? The filters argument of the MessageHandler constructor is currently a positional argument and defaults to filters.ALL...
X Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? The filters argument of the MessageHandler constructor is currently a positional argument and defaults to filters.ALL...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/3394
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[FEATURE] Switch `filters` to kwarg in `MessageHandler`","articleBody":"### What kind of feature are you missing? Where do you notice a shortcoming of PTB?\n\nThe `filters` argument of the `MessageHandler` constructor is currently a positional argument and defaults to `filters.ALL` if `None` is explicitly passed:\r\n\r\nhttps://github.com/python-telegram-bot/python-telegram-bot/blob/637cc574ab2eab39055a2bd08827c67e9503cd7a/telegram/ext/_messagehandler.py#L82-L90\n\n### Describe the solution you'd like\n\nUsing a keyword argument instead:\r\n\r\n```python\r\n def __init__( \r\n self,\r\n callback: HandlerCallback[Update, CCT, RT],\r\n filters: filters_module.BaseFilter = filters.ALL,\r\n block: DVInput[bool] = DEFAULT_TRUE,\r\n ): \r\n \r\n super().__init__(callback, block=block) \r\n self.filters = filters\r\n```\r\n\r\nOr something similar.\r\n\r\nDocumentation could be improved as well:\r\n\r\nhttps://github.com/python-telegram-bot/python-telegram-bot/blob/637cc574ab2eab39055a2bd08827c67e9503cd7a/telegram/ext/_messagehandler.py#L47-L51\r\n\r\nSeems unclear to me when it is stating `pass ``~filters.UpdateType.*`` in the filter argument. `\n\n### Describe alternatives you've considered\n\n_No response_\n\n### Additional context\n\n_No response_","author":{"url":"https://github.com/Viicos","@type":"Person","name":"Viicos"},"datePublished":"2022-11-27T10:12:43Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/3394"}
| 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:473c70a0-4e98-e5f7-41c7-8e0b0cd7eebe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AAC0:4D9F2:2736875:33B1752:6B0269BF |
| html-safe-nonce | 88f6fa81a12bb747cb532e6bd861b974b618872b31ef164916934de0b339b3e1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUMwOjREOUYyOjI3MzY4NzU6MzNCMTc1Mjo2QjAyNjlCRiIsInZpc2l0b3JfaWQiOiIxMjgwMzA0MjEwNTYyNDEwOTQzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 84fe8614ff729266bda23cfa910171a645cbd31e6829ca37b241e5419dfbb459 |
| hovercard-subject-tag | issue:1465392515 |
| 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/3394/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4772b17af6f25d3607268afedf3932f2d239269d50d8a859347de4651f6bd4c4/python-telegram-bot/python-telegram-bot/issues/3394 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4772b17af6f25d3607268afedf3932f2d239269d50d8a859347de4651f6bd4c4/python-telegram-bot/python-telegram-bot/issues/3394 |
| og:image:alt | What kind of feature are you missing? Where do you notice a shortcoming of PTB? The filters argument of the MessageHandler constructor is currently a positional argument and defaults to filters.ALL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Viicos |
| 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