From 8fc4b5902bb183f49a33512b64ce509fba8558ec Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Thu, 5 Jan 2017 01:08:02 +0000 Subject: [PATCH] Fix some crashes --- telematrix/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telematrix/__init__.py b/telematrix/__init__.py index 1de6b8a..9827a37 100644 --- a/telematrix/__init__.py +++ b/telematrix/__init__.py @@ -151,7 +151,7 @@ async def matrix_transaction(request): body = await request.json() events = body['events'] for event in events: - if event['age'] > 600000: + if 'age' in event and event['age'] > 600000: print('discarded event of age', event['age']) continue try: @@ -482,6 +482,8 @@ async def aiotg_message(chat, match): elif 'reply_to_message' in chat.message: re_msg = chat.message['reply_to_message'] + if not 'text' in re_msg: + return if 'last_name' in re_msg['from']: msg_from = '{} {} (Telegram)'.format(re_msg['from']['first_name'], re_msg['from']['last_name'])