From ff1c6bf883e99f1b274b9d5d53258974bb71182a Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Mon, 26 Sep 2016 00:56:22 +0200 Subject: [PATCH] Fix forward/reply grammar --- app_service.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app_service.py b/app_service.py index da65c07..a0bd091 100644 --- a/app_service.py +++ b/app_service.py @@ -247,10 +247,10 @@ async def aiotg_message(chat, match): date = datetime.datetime.fromtimestamp(fw_from['date']) quoted_msg = '\n'.join(['>{}'.format(x) for x in message.split('\n')]) - quoted_msg = 'Forwarded from {}, said at {}:\n{}'.format(msg_from, date, quoted_msg) + quoted_msg = 'Forwarded from {}, who {} said:\n{}'.format(msg_from, date, quoted_msg) quoted_html = '
{}
'.format(html.escape(message).replace('\n', '
')) - quoted_html = 'Forwarded from {}, said at {}:\n{}'.format(html.escape(msg_from), html.escape(str(date)), quoted_html) + quoted_html = 'Forwarded from {}, who {} said:\n{}'.format(html.escape(msg_from), html.escape(str(date)), quoted_html) j = await send_matrix_message(room_id, user_id, txn_id, body=quoted_msg, formatted_body=quoted_html, format='org.matrix.custom.html', msgtype='m.text') elif 'reply_to_message' in chat.message: re_msg = chat.message['reply_to_message'] @@ -258,13 +258,13 @@ async def aiotg_message(chat, match): msg_from = '{} {} (Telegram)'.format(re_msg['from']['first_name'], re_msg['from']['last_name']) else: msg_from = '{} (Telegram)'.format(re_msg['from']['first_name']) - date = datetime.datetime.fromtimestamp(re_msg['date']) + date = datetime.datetime.fromtimestamp(re_msg['date']).strftime('on %Y-%m-%d at %H:%M:%S') quoted_msg = '\n'.join(['>{}'.format(x) for x in re_msg['text'].split('\n')]) - quoted_msg = 'Reply to {}, said at {}:\n{}\n\n{}'.format(msg_from, date, quoted_msg, message) + quoted_msg = 'Reply to {}, who {} said:\n{}\n\n{}'.format(msg_from, date, quoted_msg, message) quoted_html = '
{}
'.format(html.escape(re_msg['text']).replace('\n', '
')) - quoted_html = 'Reply to {}, said at {}:
{}

{}

'.format(html.escape(msg_from), html.escape(str(date)), quoted_html, html.escape(message).replace('\n', '
')) + quoted_html = 'Reply to {}, who {} said:
{}

{}

'.format(html.escape(msg_from), html.escape(str(date)), quoted_html, html.escape(message).replace('\n', '
')) j = await send_matrix_message(room_id, user_id, txn_id, body=quoted_msg, formatted_body=quoted_html, format='org.matrix.custom.html', msgtype='m.text') else: