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:
|
def __init__( |
|
self, |
|
filters: filters_module.BaseFilter, |
|
callback: HandlerCallback[Update, CCT, RT], |
|
block: DVInput[bool] = DEFAULT_TRUE, |
|
): |
|
|
|
super().__init__(callback, block=block) |
|
self.filters = filters if filters is not None else filters_module.ALL |
Describe the solution you'd like
Using a keyword argument instead:
def __init__(
self,
callback: HandlerCallback[Update, CCT, RT],
filters: filters_module.BaseFilter = filters.ALL,
block: DVInput[bool] = DEFAULT_TRUE,
):
super().__init__(callback, block=block)
self.filters = filters
Or something similar.
Documentation could be improved as well:
|
operators (& for and, | for or, ~ for not). This defaults to all message updates |
|
being: :attr:`telegram.Update.message`, :attr:`telegram.Update.edited_message`, |
|
:attr:`telegram.Update.channel_post` and :attr:`telegram.Update.edited_channel_post`. |
|
If you don't want or need any of those pass ``~filters.UpdateType.*`` in the filter |
|
argument. |
Seems unclear to me when it is stating pass ``~filters.UpdateType.*`` in the filter argument.
Describe alternatives you've considered
No response
Additional context
No response
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
The
filtersargument of theMessageHandlerconstructor is currently a positional argument and defaults tofilters.ALLifNoneis explicitly passed:python-telegram-bot/telegram/ext/_messagehandler.py
Lines 82 to 90 in 637cc57
Describe the solution you'd like
Using a keyword argument instead:
Or something similar.
Documentation could be improved as well:
python-telegram-bot/telegram/ext/_messagehandler.py
Lines 47 to 51 in 637cc57
Seems unclear to me when it is stating
pass ``~filters.UpdateType.*`` in the filter argument.Describe alternatives you've considered
No response
Additional context
No response