From 2add34c70261949cfcd18df5b602a1a2f6eb4da4 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Fri, 4 Jun 2021 12:28:33 +0300 Subject: [PATCH] Fix special case when content_type is None --- telebot/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index b1c1093..f6277ae 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -2254,8 +2254,8 @@ class TeleBot: """ test_cases = { 'content_types': lambda msg: msg.content_type in filter_value, - 'regexp': lambda msg: msg.content_type == 'text' and re.search(filter_value, msg.text, re.IGNORECASE), - 'commands': lambda msg: msg.content_type == 'text' and util.extract_command(msg.text) in filter_value, + 'regexp': lambda msg: msg.content_type and msg.content_type == 'text' and re.search(filter_value, msg.text, re.IGNORECASE), + 'commands': lambda msg: msg.content_type and msg.content_type == 'text' and util.extract_command(msg.text) in filter_value, 'func': lambda msg: filter_value(msg) }