From a2640775dc50ce11ad283934e04cd661fb381d8b Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 23 Apr 2018 13:49:31 +0200 Subject: [PATCH] Allow passing msg ids as int in forward_messages() --- pyrogram/client/client.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 6276793a..800ea296 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1122,7 +1122,7 @@ class Client: def forward_messages(self, chat_id: int or str, from_chat_id: int or str, - message_ids: list, + message_ids: list or int, disable_notification: bool = None): """Use this method to forward messages of any kind. @@ -1139,8 +1139,8 @@ class Client: For a contact that exists in your Telegram address book you can use his phone number (str). For a private channel/supergroup you can use its *t.me/joinchat/* link. - message_ids (``list``): - A list of Message identifiers in the chat specified in *from_chat_id*. + message_ids (``list`` | ``int``): + A list of Message identifiers in the chat specified in *from_chat_id* or a single message id. disable_notification (``bool``, optional): Sends the message silently. @@ -1152,6 +1152,12 @@ class Client: Raises: :class:`Error ` """ + message_ids = ( + message_ids + if isinstance(message_ids, list) + else [message_ids] + ) + return self.send( functions.messages.ForwardMessages( to_peer=self.resolve_peer(chat_id),