From 159090483f47e93f7c6b212c829c0b59589ec101 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 21 Mar 2019 14:04:46 +0100 Subject: [PATCH 1/2] Update style --- .../client/methods/messages/forward_messages.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pyrogram/client/methods/messages/forward_messages.py b/pyrogram/client/methods/messages/forward_messages.py index 39db4bee..dad01a7f 100644 --- a/pyrogram/client/methods/messages/forward_messages.py +++ b/pyrogram/client/methods/messages/forward_messages.py @@ -77,11 +77,13 @@ class ForwardMessages(BaseClient): message_ids = list(message_ids) if is_iterable else [message_ids] if as_copy: - sent_messages = [] + forwarded_messages = [] + for chunk in [message_ids[i:i + 200] for i in range(0, len(message_ids), 200)]: messages = self.get_messages(chat_id=from_chat_id, message_ids=chunk) # type: pyrogram.Messages + for message in messages.messages: - sent_messages.append( + forwarded_messages.append( message.forward( chat_id, disable_notification=disable_notification, @@ -89,11 +91,12 @@ class ForwardMessages(BaseClient): remove_caption=remove_caption ) ) + return pyrogram.Messages( client=self, - total_count=len(sent_messages), - messages=sent_messages - ) if is_iterable else sent_messages[0] + total_count=len(forwarded_messages), + messages=forwarded_messages + ) if is_iterable else forwarded_messages[0] else: r = self.send( functions.messages.ForwardMessages( From 41729cbdda3fe03496217d82b9a6ea0a37884354 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 21 Mar 2019 14:08:09 +0100 Subject: [PATCH 2/2] Fix argument not passed with name --- pyrogram/client/types/messages_and_media/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 4ead0d30..08e20975 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -2682,7 +2682,7 @@ class Message(PyrogramType, Update): raise ValueError("Unknown media type") if self.sticker or self.video_note: # Sticker and VideoNote should have no caption - return send_media(file_id) + return send_media(file_id=file_id) else: return send_media(file_id=file_id, caption=caption, parse_mode=ParseMode.HTML) else: