diff --git a/telegrambot.py b/telegrambot.py index 607644b0..07a0be96 100644 --- a/telegrambot.py +++ b/telegrambot.py @@ -298,6 +298,7 @@ def cmd_search(bot: Bot, update: Update): text = update.message.text.split(" ", 1)[1] if text is None: return + text = text.replace('%','\\%').replace('_','\_') entries = session.query(db.Diario).filter(db.Diario.text.ilike('%'+text+'%')).all() messageText = "Ecco i risulati della ricerca:\n" for entry in entries[:5]: