pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

problem with regexp

Open hamidko opened this issue 6 years ago • 1 comments

hi, I write this for example: @bot.message_handler(regexp = "london") def London_city(message): blabla but when a user send to bot: "london streets" , the above function react! how I get function reaction on just "london" phrase?!

hamidko avatar Mar 11 '20 05:03 hamidko

This is the way regexp works. image

Use lambda instead. bot.message_handler(func=lambda mess: mess.text == "london")

Badiboy avatar Apr 15 '20 11:04 Badiboy