diff --git a/pyrogram/client/methods/users/get_user_profile_photos.py b/pyrogram/client/methods/users/get_user_profile_photos.py index 552ebb9a..1403eb79 100644 --- a/pyrogram/client/methods/users/get_user_profile_photos.py +++ b/pyrogram/client/methods/users/get_user_profile_photos.py @@ -16,8 +16,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import pyrogram from pyrogram.api import functions -from ...ext import BaseClient, utils +from ...ext import BaseClient class GetUserProfilePhotos(BaseClient): @@ -47,7 +48,8 @@ class GetUserProfilePhotos(BaseClient): Raises: :class:`Error ` in case of a Telegram RPC error. """ - return utils.parse_profile_photos( + return pyrogram.UserProfilePhotos.parse( + self, self.send( functions.photos.GetUserPhotos( user_id=self.resolve_peer(user_id), diff --git a/pyrogram/client/types/messages_and_media/user_profile_photos.py b/pyrogram/client/types/messages_and_media/user_profile_photos.py index 8133cae4..ca277a95 100644 --- a/pyrogram/client/types/messages_and_media/user_profile_photos.py +++ b/pyrogram/client/types/messages_and_media/user_profile_photos.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +from pyrogram.api import types +from .photo import Photo from ..pyrogram_type import PyrogramType @@ -35,3 +37,12 @@ class UserProfilePhotos(PyrogramType): self.total_count = total_count self.photos = photos + + @staticmethod + def parse(client, photos) -> "UserProfilePhotos": + return UserProfilePhotos( + total_count=len(photos.photos) if isinstance(photos, types.photos.Photos) else photos.count, + photos=[Photo.parse(client, photo) for photo in photos.photos], + client=client, + raw=photos + )