1616# You should have received a copy of the GNU Lesser General Public License
1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
19+ import pyrogram
1920from pyrogram .api import functions , types
20- from ...ext import BaseClient , utils
21+ from ...ext import BaseClient
2122
2223
2324class GetMessages (BaseClient ):
@@ -48,10 +49,9 @@ def get_messages(self,
4849 The number of subsequent replies to get for each message. Defaults to 1.
4950
5051 Returns:
51- On success and in case *message_ids* or *reply_to_message_ids* was a list, the returned value will be a
52- list of the requested :obj:`Messages <pyrogram.Messages>` even if a list contains just one element,
53- otherwise if *message_ids* or *reply_to_message_ids* was an integer, the single requested
54- :obj:`Message <pyrogram.Message>` is returned.
52+ On success and in case *message_ids* or *reply_to_message_ids* was an iterable, the returned value will be a
53+ :obj:`Messages <pyrogram.Messages>` even if a list contains just one element. Otherwise, if *message_ids* or
54+ *reply_to_message_ids* was an integer, the single requested :obj:`Message <pyrogram.Message>` is returned.
5555
5656 Raises:
5757 :class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
@@ -76,13 +76,6 @@ def get_messages(self,
7676 else :
7777 rpc = functions .messages .GetMessages (id = ids )
7878
79- r = self .send (rpc )
79+ messages = pyrogram . Messages . parse ( self , self .send (rpc ) )
8080
81- messages = utils .parse_messages (
82- self , r .messages ,
83- {i .id : i for i in r .users },
84- {i .id : i for i in r .chats },
85- replies = replies
86- )
87-
88- return messages if is_iterable else messages [0 ]
81+ return messages if is_iterable else messages .messages [0 ]
0 commit comments