main.py: enable MarkdownV2 formatting
This commit is contained in:
parent
ba353a3609
commit
12ee02cee0
17
main.py
17
main.py
|
@ -189,10 +189,19 @@ def queue_processor():
|
||||||
if mod.enabled:
|
if mod.enabled:
|
||||||
if mod.version == 1 or mod.version == 2:
|
if mod.version == 1 or mod.version == 2:
|
||||||
response = mod.process(msg)
|
response = mod.process(msg)
|
||||||
|
|
||||||
if response:
|
if response:
|
||||||
|
# protecting output
|
||||||
|
response = response.replace("(", "\\(")
|
||||||
|
response = response.replace(")", "\\)")
|
||||||
|
response = response.replace("!", "\\!")
|
||||||
|
response = response.replace(".", "\\.")
|
||||||
|
response = response.replace("=", "\\=")
|
||||||
|
|
||||||
updater.bot.send_message(chat_id=msg.chat.id, text=response,
|
updater.bot.send_message(chat_id=msg.chat.id, text=response,
|
||||||
disable_web_page_preview=True)
|
disable_web_page_preview=True,
|
||||||
print(f"Responded using module {mod.path} ({mod.alias}) with text: {responce}")
|
parse_mode="MarkdownV2")
|
||||||
|
print(f"Responded using module {mod.path} ({mod.alias}) with text: {response}")
|
||||||
break
|
break
|
||||||
|
|
||||||
del message_queue[0]
|
del message_queue[0]
|
||||||
|
@ -203,9 +212,9 @@ def queue_processor():
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
print(f"[ERROR] queue_processor: current message queue: {message_queue}")
|
print(f"[ERROR] queue_processor: current message queue: {message_queue}")
|
||||||
print("[ERROR] queue_processor: error while processing message, trying to delete it...")
|
print(f"[ERROR] queue_processor: error while processing message ({e}), trying to delete it...")
|
||||||
try:
|
try:
|
||||||
del message_queue[0]
|
del message_queue[0]
|
||||||
print("[INFO] queue_processor: deleted broken message from the queue")
|
print("[INFO] queue_processor: deleted broken message from the queue")
|
||||||
|
|
Loading…
Reference in New Issue