mirror of
https://github.com/Rongronggg9/SlashBot.git
synced 2025-04-29 22:53:33 +08:00
[F] Fix HTTP 400 error from incomplete markdowns
This commit is contained in:
parent
c0488d7d9a
commit
25ec388df8
@ -95,12 +95,13 @@ def get_text(mention_from, mention_rpl, command):
|
|||||||
def reply(update, context):
|
def reply(update, context):
|
||||||
print(update.to_dict())
|
print(update.to_dict())
|
||||||
msg = update.to_dict()['message']
|
msg = update.to_dict()['message']
|
||||||
command = msg['text']
|
|
||||||
from_user, rpl_user = get_users(msg)
|
from_user, rpl_user = get_users(msg)
|
||||||
|
|
||||||
mention_from, mention_rpl = mention(from_user), mention(rpl_user)
|
# Escape markdown
|
||||||
|
command = msg['text']
|
||||||
|
command = command.replace("_", "\\_").replace("*", "\\*").replace("[", "\\[").replace("`", "\\`")
|
||||||
|
|
||||||
text = get_text(mention_from, mention_rpl, command)
|
text = get_text(mention(from_user), mention(rpl_user), command)
|
||||||
print(text, end='\n\n')
|
print(text, end='\n\n')
|
||||||
|
|
||||||
update.effective_message.reply_text(text, parse_mode='Markdown')
|
update.effective_message.reply_text(text, parse_mode='Markdown')
|
||||||
|
Loading…
Reference in New Issue
Block a user