Escape definitivo

This commit is contained in:
Joan Cano
2023-03-02 12:50:59 +01:00
parent ff648e7742
commit b041f70eba

View File

@@ -4,7 +4,7 @@ TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '#', '+',
def telegram_escape_characters(text): def telegram_escape_characters(text):
for character in TELEGRAM_ESCAPE_CHARACTERS: for character in TELEGRAM_ESCAPE_CHARACTERS:
try: try:
text = text.replace(character, f'\{character}') text = text.replace(character, f'\\{character}')
except: except:
pass pass
return text return text