From 6a22e2e262adf8932b61f1e74879f6d1072afb4e Mon Sep 17 00:00:00 2001 From: Legenda24 <48826466+Legenda24@users.noreply.github.com> Date: Sat, 27 Feb 2021 22:53:18 +0500 Subject: [PATCH] Add bound method get_media_group() (#593) * Bound method - get_media_group() * Update message.py Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com> --- pyrogram/types/messages_and_media/message.py | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 0ac26f23..6f8b7e4b 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -706,6 +706,33 @@ class Message(Object, Update): else: return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.message_id}" + async def get_media_group(self) -> List["types.Message"]: + """Bound method *get_media_group* of :obj:`~pyrogram.types.Message`. + + Use as a shortcut for: + + .. code-block:: python + client.get_media_group( + chat_id=message.chat.id, + message_id=message.message_id + ) + + Example: + .. code-block:: python + message.get_media_group() + + Returns: + List of :obj:`~pyrogram.types.Message`: On success, a list of messages of the media group is returned. + + Raises: + ValueError: In case the passed message id doesn't belong to a media group. + """ + + return await self._client.get_media_group( + chat_id=self.chat.id, + message_id=self.message_id + ) + async def reply_text( self, text: str,