From d3bea4c3b4e34b2714858b1dea12b35b189c3c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 3 Nov 2015 10:20:45 +0100 Subject: [PATCH 1/2] make user_from optional, because of channels --- telegram/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/message.py b/telegram/message.py index e77f3ea4b..8e9242ea1 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -134,7 +134,7 @@ class Message(TelegramObject): if not data: return None - data['from_user'] = User.de_json(data['from']) + data['from_user'] = User.de_json(data.get('from')) data['date'] = datetime.fromtimestamp(data['date']) if 'first_name' in data.get('chat', ''): data['chat'] = User.de_json(data.get('chat')) From 89015e5ecc1fd5dce1831a7fe62b7c8e118ccef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 3 Nov 2015 13:46:23 +0100 Subject: [PATCH 2/2] fix for sending into a channel --- telegram/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/message.py b/telegram/message.py index 8e9242ea1..d427ac69e 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -185,7 +185,7 @@ class Message(TelegramObject): data = super(Message, self).to_dict() # Required - data['from'] = data.pop('from_user') + data['from'] = data.pop('from_user', None) data['date'] = self._totimestamp(self.date) # Optionals if self.forward_date: