1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #317 from MonsterDeveloper/patch-4

Added IGNORECASE flag to message_handler
This commit is contained in:
FrankWang 2017-04-05 14:12:07 +08:00 committed by GitHub
commit 94d723cf7b

View File

@ -852,7 +852,7 @@ class TeleBot:
def _test_filter(self, filter, filter_value, message): def _test_filter(self, filter, filter_value, message):
test_cases = { test_cases = {
'content_types': lambda msg: msg.content_type in filter_value, 'content_types': lambda msg: msg.content_type in filter_value,
'regexp': lambda msg: msg.content_type == 'text' and re.search(filter_value, msg.text), '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, 'commands': lambda msg: msg.content_type == 'text' and util.extract_command(msg.text) in filter_value,
'func': lambda msg: filter_value(msg) 'func': lambda msg: filter_value(msg)
} }