diff --git a/docs/source/api/types.rst b/docs/source/api/types.rst index 15f81ae7..4eef9638 100644 --- a/docs/source/api/types.rst +++ b/docs/source/api/types.rst @@ -45,7 +45,7 @@ Messages & Media - :class:`Messages` - :class:`MessageEntity` - :class:`Photo` - - :class:`Photos` + - :class:`ProfilePhotos` - :class:`Thumbnail` - :class:`Audio` - :class:`Document` @@ -133,7 +133,7 @@ Details .. autoclass:: Messages() .. autoclass:: MessageEntity() .. autoclass:: Photo() -.. autoclass:: Photos() +.. autoclass:: ProfilePhotos() .. autoclass:: Thumbnail() .. autoclass:: Audio() .. autoclass:: Document() diff --git a/pyrogram/client/methods/users/get_profile_photos.py b/pyrogram/client/methods/users/get_profile_photos.py index d45bd5b6..e4e202e0 100644 --- a/pyrogram/client/methods/users/get_profile_photos.py +++ b/pyrogram/client/methods/users/get_profile_photos.py @@ -29,7 +29,7 @@ class GetProfilePhotos(BaseClient): chat_id: Union[int, str], offset: int = 0, limit: int = 100 - ) -> "pyrogram.Photos": + ) -> "pyrogram.ProfilePhotos": """Get a list of profile pictures for a user or a chat. Parameters: @@ -47,7 +47,7 @@ class GetProfilePhotos(BaseClient): Values between 1—100 are accepted. Defaults to 100. Returns: - :obj:`Photos`: On success, an object containing a list of the profile photos is returned. + :obj:`ProfilePhotos`: On success, an object containing a list of the profile photos is returned. Raises: RPCError: In case of a Telegram RPC error. @@ -55,7 +55,7 @@ class GetProfilePhotos(BaseClient): peer_id = self.resolve_peer(chat_id) if isinstance(peer_id, types.InputPeerUser): - return pyrogram.Photos._parse( + return pyrogram.ProfilePhotos._parse( self, self.send( functions.photos.GetUserPhotos( @@ -86,7 +86,7 @@ class GetProfilePhotos(BaseClient): ) ) - return pyrogram.Photos( + return pyrogram.ProfilePhotos( total_count=new_chat_photos.total_count, - photos=[m.new_chat_photo for m in new_chat_photos.messages][:limit] + profile_photos=[m.new_chat_photo for m in new_chat_photos.messages][:limit] ) diff --git a/pyrogram/client/types/messages_and_media/__init__.py b/pyrogram/client/types/messages_and_media/__init__.py index d312611b..17a6e36a 100644 --- a/pyrogram/client/types/messages_and_media/__init__.py +++ b/pyrogram/client/types/messages_and_media/__init__.py @@ -28,10 +28,10 @@ from .messages import Messages from .photo import Photo from .poll import Poll from .poll_option import PollOption +from .profile_photos import ProfilePhotos from .sticker import Sticker from .stripped_thumbnail import StrippedThumbnail from .thumbnail import Thumbnail -from .photos import Photos from .venue import Venue from .video import Video from .video_note import VideoNote @@ -39,5 +39,6 @@ from .voice import Voice __all__ = [ "Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Messages", "Photo", - "Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "Photos", "Venue", "Video", "VideoNote", "Voice" + "Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "ProfilePhotos", "Venue", "Video", "VideoNote", + "Voice" ] diff --git a/pyrogram/client/types/messages_and_media/photos.py b/pyrogram/client/types/messages_and_media/profile_photos.py similarity index 79% rename from pyrogram/client/types/messages_and_media/photos.py rename to pyrogram/client/types/messages_and_media/profile_photos.py index a1803923..11b8e4dd 100644 --- a/pyrogram/client/types/messages_and_media/photos.py +++ b/pyrogram/client/types/messages_and_media/profile_photos.py @@ -23,35 +23,35 @@ from .photo import Photo from ..object import Object -class Photos(Object): +class ProfilePhotos(Object): """Contains a user's profile pictures. Parameters: total_count (``int``): Total number of profile pictures the target user has. - photos (List of :obj:`Photo`): + profile_photos (List of :obj:`Photo`): Requested profile pictures. """ - __slots__ = ["total_count", "photos"] + __slots__ = ["total_count", "profile_photos"] def __init__( self, *, client: "pyrogram.BaseClient" = None, total_count: int, - photos: List[Photo] + profile_photos: List[Photo] ): super().__init__(client) self.total_count = total_count - self.photos = photos + self.profile_photos = profile_photos @staticmethod - def _parse(client, photos) -> "Photos": - return Photos( + def _parse(client, photos) -> "ProfilePhotos": + return ProfilePhotos( total_count=getattr(photos, "count", len(photos.photos)), - photos=[Photo._parse(client, photo) for photo in photos.photos], + profile_photos=[Photo._parse(client, photo) for photo in photos.photos], client=client )