From 73fb18c193691f87b784bf280e8b4bc9e5e71952 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Tue, 11 May 2021 23:26:22 +0300 Subject: [PATCH] Change message handler filtering order Now content_type is checked first. --- telebot/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 7fcffc9..f0b8da9 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1880,7 +1880,7 @@ class TeleBot: :param commands: Optional list of strings (commands to handle). :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 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: @@ -1888,10 +1888,10 @@ class TeleBot: def decorator(handler): handler_dict = self._build_handler_dict(handler, + content_types=content_types, commands=commands, regexp=regexp, func=func, - content_types=content_types, **kwargs) self.add_message_handler(handler_dict) return handler