Rename Photos to ProfilePhotos
This commit is contained in:
parent
8151270a94
commit
b205c6cce0
@ -45,7 +45,7 @@ Messages & Media
|
|||||||
- :class:`Messages`
|
- :class:`Messages`
|
||||||
- :class:`MessageEntity`
|
- :class:`MessageEntity`
|
||||||
- :class:`Photo`
|
- :class:`Photo`
|
||||||
- :class:`Photos`
|
- :class:`ProfilePhotos`
|
||||||
- :class:`Thumbnail`
|
- :class:`Thumbnail`
|
||||||
- :class:`Audio`
|
- :class:`Audio`
|
||||||
- :class:`Document`
|
- :class:`Document`
|
||||||
@ -133,7 +133,7 @@ Details
|
|||||||
.. autoclass:: Messages()
|
.. autoclass:: Messages()
|
||||||
.. autoclass:: MessageEntity()
|
.. autoclass:: MessageEntity()
|
||||||
.. autoclass:: Photo()
|
.. autoclass:: Photo()
|
||||||
.. autoclass:: Photos()
|
.. autoclass:: ProfilePhotos()
|
||||||
.. autoclass:: Thumbnail()
|
.. autoclass:: Thumbnail()
|
||||||
.. autoclass:: Audio()
|
.. autoclass:: Audio()
|
||||||
.. autoclass:: Document()
|
.. autoclass:: Document()
|
||||||
|
@ -29,7 +29,7 @@ class GetProfilePhotos(BaseClient):
|
|||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
offset: int = 0,
|
offset: int = 0,
|
||||||
limit: int = 100
|
limit: int = 100
|
||||||
) -> "pyrogram.Photos":
|
) -> "pyrogram.ProfilePhotos":
|
||||||
"""Get a list of profile pictures for a user or a chat.
|
"""Get a list of profile pictures for a user or a chat.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@ -47,7 +47,7 @@ class GetProfilePhotos(BaseClient):
|
|||||||
Values between 1—100 are accepted. Defaults to 100.
|
Values between 1—100 are accepted. Defaults to 100.
|
||||||
|
|
||||||
Returns:
|
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:
|
Raises:
|
||||||
RPCError: In case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
@ -55,7 +55,7 @@ class GetProfilePhotos(BaseClient):
|
|||||||
peer_id = self.resolve_peer(chat_id)
|
peer_id = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
if isinstance(peer_id, types.InputPeerUser):
|
if isinstance(peer_id, types.InputPeerUser):
|
||||||
return pyrogram.Photos._parse(
|
return pyrogram.ProfilePhotos._parse(
|
||||||
self,
|
self,
|
||||||
self.send(
|
self.send(
|
||||||
functions.photos.GetUserPhotos(
|
functions.photos.GetUserPhotos(
|
||||||
@ -86,7 +86,7 @@ class GetProfilePhotos(BaseClient):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return pyrogram.Photos(
|
return pyrogram.ProfilePhotos(
|
||||||
total_count=new_chat_photos.total_count,
|
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]
|
||||||
)
|
)
|
||||||
|
@ -28,10 +28,10 @@ from .messages import Messages
|
|||||||
from .photo import Photo
|
from .photo import Photo
|
||||||
from .poll import Poll
|
from .poll import Poll
|
||||||
from .poll_option import PollOption
|
from .poll_option import PollOption
|
||||||
|
from .profile_photos import ProfilePhotos
|
||||||
from .sticker import Sticker
|
from .sticker import Sticker
|
||||||
from .stripped_thumbnail import StrippedThumbnail
|
from .stripped_thumbnail import StrippedThumbnail
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from .photos import Photos
|
|
||||||
from .venue import Venue
|
from .venue import Venue
|
||||||
from .video import Video
|
from .video import Video
|
||||||
from .video_note import VideoNote
|
from .video_note import VideoNote
|
||||||
@ -39,5 +39,6 @@ from .voice import Voice
|
|||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Messages", "Photo",
|
"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"
|
||||||
]
|
]
|
||||||
|
@ -23,35 +23,35 @@ from .photo import Photo
|
|||||||
from ..object import Object
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
class Photos(Object):
|
class ProfilePhotos(Object):
|
||||||
"""Contains a user's profile pictures.
|
"""Contains a user's profile pictures.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
total_count (``int``):
|
total_count (``int``):
|
||||||
Total number of profile pictures the target user has.
|
Total number of profile pictures the target user has.
|
||||||
|
|
||||||
photos (List of :obj:`Photo`):
|
profile_photos (List of :obj:`Photo`):
|
||||||
Requested profile pictures.
|
Requested profile pictures.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ["total_count", "photos"]
|
__slots__ = ["total_count", "profile_photos"]
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
client: "pyrogram.BaseClient" = None,
|
client: "pyrogram.BaseClient" = None,
|
||||||
total_count: int,
|
total_count: int,
|
||||||
photos: List[Photo]
|
profile_photos: List[Photo]
|
||||||
):
|
):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
|
|
||||||
self.total_count = total_count
|
self.total_count = total_count
|
||||||
self.photos = photos
|
self.profile_photos = profile_photos
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse(client, photos) -> "Photos":
|
def _parse(client, photos) -> "ProfilePhotos":
|
||||||
return Photos(
|
return ProfilePhotos(
|
||||||
total_count=getattr(photos, "count", len(photos.photos)),
|
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
|
client=client
|
||||||
)
|
)
|
Loading…
Reference in New Issue
Block a user