2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Merge develop -> asyncio-dev

This commit is contained in:
Dan 2020-04-06 14:54:55 +02:00
commit 570cb888b2
3 changed files with 16 additions and 24 deletions

View File

@ -523,7 +523,7 @@ class Message(Object, Update):
if media:
if isinstance(media, types.MessageMediaPhoto):
photo = Photo._parse(client, media)
photo = Photo._parse(client, media.photo, media.ttl_seconds)
elif isinstance(media, types.MessageMediaGeo):
location = Location._parse(client, media.geo)
elif isinstance(media, types.MessageMediaContact):

View File

@ -80,9 +80,7 @@ class Photo(Object):
self.thumbs = thumbs
@staticmethod
def _parse(client, media_photo: types.MessageMediaPhoto) -> "Photo":
photo = media_photo.photo
def _parse(client, photo: types.Photo, ttl_seconds: int = None) -> "Photo":
if isinstance(photo, types.Photo):
big = photo.sizes[-1]
@ -98,7 +96,7 @@ class Photo(Object):
file_ref=encode_file_ref(photo.file_reference),
width=big.w,
height=big.h,
ttl_seconds=media_photo.ttl_seconds,
ttl_seconds=ttl_seconds,
file_size=big.size,
date=photo.date,
thumbs=Thumbnail._parse(client, photo),

View File

@ -566,15 +566,8 @@ class Chat(Object):
return await self._client.restrict_chat_member(
chat_id=self.id,
user_id=user_id,
permissions=permissions,
until_date=until_date,
can_send_messages=permissions.can_send_messages,
can_send_media_messages=permissions.can_send_media_messages,
can_send_other_messages=permissions.can_send_other_messages,
can_add_web_page_previews=permissions.can_add_web_page_previews,
can_send_polls=permissions.can_send_polls,
can_change_info=permissions.can_change_info,
can_invite_users=permissions.can_invite_users,
can_pin_messages=permissions.can_pin_messages
)
async def promote_member(
@ -760,7 +753,7 @@ class Chat(Object):
offset: int = 0,
limit: int = 200,
query: str = "",
filter: str = Filters.ALL
filter: str = "all"
) -> List["pyrogram.ChatMember"]:
"""Bound method *get_members* of :obj:`Chat`.
@ -772,6 +765,7 @@ class Chat(Object):
Example:
.. code-block:: python
# Get first 200 recent members
chat.get_members()
@ -791,7 +785,7 @@ class Chat(Object):
self,
limit: int = 0,
query: str = "",
filter: str = Filters.ALL
filter: str = "all"
) -> Optional[Generator["pyrogram.ChatMember", None, None]]:
"""Bound method *iter_members* of :obj:`Chat`.
@ -812,7 +806,7 @@ class Chat(Object):
``Generator``: A generator yielding :obj:`ChatMember` objects.
"""
return self._client.iter_chat_members(
return await self._client.iter_chat_members(
self.id,
limit=limit,
query=query,