Remove ProfilePhotos type · Python-Repository-Hub/pyrogram@797de05 · GitHub
Skip to content

Commit 797de05

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

5 files changed

Lines changed: 14 additions & 79 deletions

File tree

docs/source/api/types.rst

Lines changed: 0 additions & 2 deletions

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

pyrogram/client/types/messages_and_media/profile_photos.py

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

0 commit comments

Comments
 (0)