diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index 2f758e9..1cab6aa 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -14,7 +14,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.4.16" +__version__ = "2.4.17" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/utilities.py b/davtelepot/utilities.py index 574cbc9..a8bfd8a 100644 --- a/davtelepot/utilities.py +++ b/davtelepot/utilities.py @@ -858,7 +858,8 @@ def get_cleaned_text(update, bot=None, replace=[], strip='/ @'): ) ) text = update['text'].strip(strip) - for s in replace: + # Replace longer strings first + for s in sorted(replace, key=len, reverse=True): while s and text.lower().startswith(s.lower()): text = text[len(s):] return text.strip(strip)