mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Change message handler filtering order
Now content_type is checked first.
This commit is contained in:
parent
990bb827be
commit
73fb18c193
@ -1880,7 +1880,7 @@ class TeleBot:
|
|||||||
:param commands: Optional list of strings (commands to handle).
|
:param commands: Optional list of strings (commands to handle).
|
||||||
:param regexp: Optional regular expression.
|
:param regexp: Optional regular expression.
|
||||||
:param func: Optional lambda function. The lambda receives the message to test as the first parameter. It must return True if the command should handle the message.
|
:param func: Optional lambda function. The lambda receives the message to test as the first parameter. It must return True if the command should handle the message.
|
||||||
:param content_types: This commands' supported content types. Must be a list. Defaults to ['text'].
|
:param content_types: Supported message content types. Must be a list. Defaults to ['text'].
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if content_types is None:
|
if content_types is None:
|
||||||
@ -1888,10 +1888,10 @@ class TeleBot:
|
|||||||
|
|
||||||
def decorator(handler):
|
def decorator(handler):
|
||||||
handler_dict = self._build_handler_dict(handler,
|
handler_dict = self._build_handler_dict(handler,
|
||||||
|
content_types=content_types,
|
||||||
commands=commands,
|
commands=commands,
|
||||||
regexp=regexp,
|
regexp=regexp,
|
||||||
func=func,
|
func=func,
|
||||||
content_types=content_types,
|
|
||||||
**kwargs)
|
**kwargs)
|
||||||
self.add_message_handler(handler_dict)
|
self.add_message_handler(handler_dict)
|
||||||
return handler
|
return handler
|
||||||
|
Loading…
Reference in New Issue
Block a user