add support for parse_mode selection in all module APIs and update modules to respect these changes

This commit is contained in:
2023-09-06 17:22:26 +03:00
parent 2b9ac41ced
commit 0497cbf9b7
5 changed files with 91 additions and 45 deletions

View File

@@ -1,6 +1,14 @@
command = self.MESSAGE['text'].split(" ", 2)
command_length = len(command)
def escaped_string(unescaped_string):
result_string = str(unescaped_string)
for i in ["/", "<", ">"]:
result_string = result_string.replace(i, f"\\{i}")
return result_string
if (command[0] in self.aliases) and (1 <= command_length <= 3):
try:
models = json.loads(readfile(self.path + "translate_models.json"))
@@ -25,7 +33,8 @@ if (command[0] in self.aliases) and (1 <= command_length <= 3):
decoded_text = decoded_text.replace(i[0].capitalize(), i[1].capitalize())
decoded_text = decoded_text.replace(i[0].upper(), i[1].upper())
self.RESPONSE = f"__Результат__\n{decoded_text}"
self.RESPONSE = f"<b><u>Результат</u></b>\n{escaped_string(decoded_text)}"
self.FORMAT = "HTML"
except Exception as e:
print(f"[translit-decoder] Got exception: {e}")