Replace longer strings first
This commit is contained in:
parent
87d95fbfed
commit
f29556300a
@ -14,7 +14,7 @@ __author__ = "Davide Testa"
|
|||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "2.4.16"
|
__version__ = "2.4.17"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
|
||||||
|
@ -858,7 +858,8 @@ def get_cleaned_text(update, bot=None, replace=[], strip='/ @'):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
text = update['text'].strip(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()):
|
while s and text.lower().startswith(s.lower()):
|
||||||
text = text[len(s):]
|
text = text[len(s):]
|
||||||
return text.strip(strip)
|
return text.strip(strip)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user