Compare commits

..

2 Commits

3 changed files with 65 additions and 5 deletions

View File

@ -319,12 +319,14 @@ def queue_processor():
def message_handler(update, context):
global lock
with lock:
if update.message.text.__class__ == str and update.message.text.startswith("$"):
if update.message and update.message.text.__class__ == str and update.message.text.startswith("$"):
print("[DEBUG] Received new message with high priority") # just for testing
message_queue.insert(0, update.message)
else:
elif update.message:
print("[DEBUG] Received new message") # just for testing
message_queue.append(update.message)
else:
print(f"[DEBUG] Received {update.message} instead of a message")
# --- Final stage ---

View File

@ -4,8 +4,14 @@ 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}")
escaping_rules = {
"<": "&lt;",
">": "&gt;",
'"': "&quot;"
}
for i in escaping_rules.items():
result_string = result_string.replace(i[0], i[1])
return result_string
@ -31,7 +37,7 @@ if (command[0] in self.aliases) and (1 <= command_length <= 3):
f"{', '.join(list(models.keys()))}"
else:
for i in models[chosen_model]:
decoded_text = decoded_text.replace(i[0], i[1])
decoded_text = decoded_text.replace(i[0].lower(), i[1].lower())
decoded_text = decoded_text.replace(i[0].capitalize(), i[1].capitalize())
decoded_text = decoded_text.replace(i[0].upper(), i[1].upper())

View File

@ -75,5 +75,57 @@
["$", ";"],
["^", ":"],
["&", "?"]
],
"en-men": [
["a", "4"],
["b", "8"],
["c", "("],
["d", "|)"],
["e", "3"],
["f", "|="],
["g", "6"],
["h", "#"],
["i", "!"],
["j", "|_"],
["k", "|<"],
["l", "1"],
["m", "//N"],
["o", "0"],
["p", "|D"],
["q", "(,)"],
["r", "|2"],
["s", "5"],
["t", "7"],
["u", "|_|"],
["w", "//"],
["v", "/"],
["x", "><"],
["y", "`/"]
],
"men-en": [
["4", "a"],
["8", "b"],
["(,)", "q"],
["(", "c"],
["|)", "d"],
["3", "e"],
["|=", "f"],
["6", "g"],
["#", "h"],
["!", "i"],
["|_|", "u"],
["|_", "j"],
["|<", "k"],
["1", "l"],
["//N", "m"],
["0", "o"],
["|D", "p"],
["|2", "r"],
["5", "s"],
["7", "t"],
["//", "w"],
["`/", "y"],
["/", "v"],
["><", "x"]
]
}