Fix Telegram forwards
This commit is contained in:
parent
9f805b87cb
commit
fe5f913ab9
@ -433,17 +433,15 @@ async def aiotg_message(chat, match):
|
|||||||
fw_from['last_name'])
|
fw_from['last_name'])
|
||||||
else:
|
else:
|
||||||
msg_from = '{} (Telegram)'.format(fw_from['first_name'])
|
msg_from = '{} (Telegram)'.format(fw_from['first_name'])
|
||||||
date = datetime.fromtimestamp(fw_from['date'])
|
|
||||||
|
|
||||||
quoted_msg = '\n'.join(['>{}'.format(x) for x in message.split('\n')])
|
quoted_msg = '\n'.join(['>{}'.format(x) for x in message.split('\n')])
|
||||||
quoted_msg = 'Forwarded from {}, who {} said:\n{}' \
|
quoted_msg = 'Forwarded from {}, who said:\n{}' \
|
||||||
.format(msg_from, date, quoted_msg)
|
.format(msg_from, quoted_msg)
|
||||||
|
|
||||||
quoted_html = '<blockquote>{}</blockquote>' \
|
quoted_html = '<blockquote>{}</blockquote>' \
|
||||||
.format(html.escape(message).replace('\n', '<br />'))
|
.format(html.escape(message).replace('\n', '<br />'))
|
||||||
quoted_html = '<i>Forwarded from {}, who {} said:</i>\n{}' \
|
quoted_html = '<i>Forwarded from {}, who said:</i>\n{}' \
|
||||||
.format(html.escape(msg_from), html.escape(str(date)),
|
.format(html.escape(msg_from), quoted_html)
|
||||||
quoted_html)
|
|
||||||
j = await send_matrix_message(room_id, user_id, txn_id,
|
j = await send_matrix_message(room_id, user_id, txn_id,
|
||||||
body=quoted_msg,
|
body=quoted_msg,
|
||||||
formatted_body=quoted_html,
|
formatted_body=quoted_html,
|
||||||
|
Loading…
Reference in New Issue
Block a user