Skip to content

Commit 797de05

Browse files
committed
Remove ProfilePhotos type
1 parent c8fd446 commit 797de05

File tree

5 files changed

+14
-79
lines changed

5 files changed

+14
-79
lines changed

docs/source/api/types.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Messages & Media
4343
- :class:`Messages`
4444
- :class:`MessageEntity`
4545
- :class:`Photo`
46-
- :class:`ProfilePhotos`
4746
- :class:`Thumbnail`
4847
- :class:`Audio`
4948
- :class:`Document`
@@ -129,7 +128,6 @@ Details
129128
.. autoclass:: Messages()
130129
.. autoclass:: MessageEntity()
131130
.. autoclass:: Photo()
132-
.. autoclass:: ProfilePhotos()
133131
.. autoclass:: Thumbnail()
134132
.. autoclass:: Audio()
135133
.. autoclass:: Document()

pyrogram/client/methods/users/get_profile_photos.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
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

2121
import pyrogram
2222
from 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])

pyrogram/client/methods/users/iter_profile_photos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def iter_profile_photos(
6363
chat_id=chat_id,
6464
offset=offset,
6565
limit=limit
66-
).photos
66+
)
6767

6868
if not photos:
6969
return

pyrogram/client/types/messages_and_media/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from .photo import Photo
2929
from .poll import Poll
3030
from .poll_option import PollOption
31-
from .profile_photos import ProfilePhotos
3231
from .sticker import Sticker
3332
from .stripped_thumbnail import StrippedThumbnail
3433
from .thumbnail import Thumbnail
@@ -39,6 +38,5 @@
3938

4039
__all__ = [
4140
"Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Messages", "Photo",
42-
"Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "ProfilePhotos", "Venue", "Video", "VideoNote",
43-
"Voice"
41+
"Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "Venue", "Video", "VideoNote", "Voice"
4442
]

pyrogram/client/types/messages_and_media/profile_photos.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)