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- from typing import Union
19+ from typing import Union , List
2020
2121import pyrogram
2222from pyrogram .api import functions , types
@@ -29,7 +29,7 @@ def get_profile_photos(
2929 chat_id : Union [int , str ],
3030 offset : int = 0 ,
3131 limit : int = 100
32- ) -> "pyrogram.ProfilePhotos" :
32+ ) -> List [ "pyrogram.Photo" ] :
3333 """Get a list of profile pictures for a user or a chat.
3434
3535 Parameters:
@@ -47,25 +47,24 @@ def get_profile_photos(
4747 Values between 1—100 are accepted. Defaults to 100.
4848
4949 Returns:
50- :obj:`ProfilePhotos `: On success, an object containing a list of the profile photos is returned.
50+ List of :obj:`Photo `: On success, a list of profile photos is returned.
5151
5252 Raises:
5353 RPCError: In case of a Telegram RPC error.
5454 """
5555 peer_id = self .resolve_peer (chat_id )
5656
5757 if isinstance (peer_id , types .InputPeerUser ):
58- return pyrogram .ProfilePhotos ._parse (
59- self ,
60- self .send (
61- functions .photos .GetUserPhotos (
62- user_id = peer_id ,
63- offset = offset ,
64- max_id = 0 ,
65- limit = limit
66- )
58+ r = self .send (
59+ functions .photos .GetUserPhotos (
60+ user_id = peer_id ,
61+ offset = offset ,
62+ max_id = 0 ,
63+ limit = limit
6764 )
6865 )
66+
67+ return pyrogram .List (pyrogram .Photo ._parse (self , photo ) for photo in r .photos )
6968 else :
7069 new_chat_photos = pyrogram .Messages ._parse (
7170 self ,
@@ -86,7 +85,4 @@ def get_profile_photos(
8685 )
8786 )
8887
89- return pyrogram .ProfilePhotos (
90- total_count = new_chat_photos .total_count ,
91- profile_photos = [m .new_chat_photo for m in new_chat_photos .messages ][:limit ]
92- )
88+ return pyrogram .List ([m .new_chat_photo for m in new_chat_photos .messages ][:limit ])
0 commit comments