From a2590f3bc848401b626ffbd4fdd7e0bdf57d5441 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 5 Apr 2018 08:26:50 +0200 Subject: [PATCH] Don't return None This will break Message Pin handling --- pyrogram/client/client.py | 3 --- pyrogram/client/utils.py | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 290a8ba9..ebb87dd3 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -730,9 +730,6 @@ class Client: elif isinstance(message, types.MessageService): m = utils.parse_message_service(message, users, chats) - if m is None: - continue - if isinstance(message.action, types.MessageActionPinMessage): pm = self.get_messages(m.chat.id, [message.reply_to_msg_id]) diff --git a/pyrogram/client/utils.py b/pyrogram/client/utils.py index 43dba6d4..68af6b84 100644 --- a/pyrogram/client/utils.py +++ b/pyrogram/client/utils.py @@ -368,7 +368,7 @@ def parse_message(message: types.Message, users: dict, chats: dict) -> pyrogram. ) -def parse_message_service(message: types.MessageService, users: dict, chats: dict) -> pyrogram.Message or None: +def parse_message_service(message: types.MessageService, users: dict, chats: dict) -> pyrogram.Message: action = message.action new_chat_members = None @@ -395,8 +395,6 @@ def parse_message_service(message: types.MessageService, users: dict, chats: dic migrate_from_chat_id = action.chat_id elif isinstance(action, types.MessageActionChatCreate): group_chat_created = True - else: - return None return pyrogram.Message( message_id=message.id, @@ -413,7 +411,6 @@ def parse_message_service(message: types.MessageService, users: dict, chats: dic group_chat_created=group_chat_created # TODO: supergroup_chat_created # TODO: channel_chat_created - # TODO: pinned_message )