Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Dan 2018-12-10 15:15:50 +01:00
commit 6d2d34617a
3 changed files with 15 additions and 0 deletions

View File

@ -326,6 +326,7 @@ def parse_messages(
video_note = None
sticker = None
document = None
web_page = None
media = message.media
@ -573,6 +574,8 @@ def parse_messages(
file_size=doc.size,
date=doc.date
)
elif isinstance(media, types.MessageMediaWebPage):
web_page = True
else:
media = None
@ -620,6 +623,7 @@ def parse_messages(
video_note=video_note,
sticker=sticker,
document=document,
web_page=web_page,
views=message.views,
via_bot=parse_user(users.get(message.via_bot_id, None)),
outgoing=message.out,

View File

@ -118,6 +118,9 @@ class Filters:
venue = create("Venue", lambda _, m: bool(m.venue))
"""Filter messages that contain :obj:`Venue <pyrogram.api.types.pyrogram.Venue>` objects."""
web_page = create("WebPage", lambda _, m: m.web_page)
"""Filter messages sent with a webpage preview."""
private = create("Private", lambda _, m: bool(m.chat and m.chat.type == "private"))
"""Filter messages sent in private chats."""

View File

@ -134,6 +134,12 @@ class Message(Object):
venue (:obj:`Venue <pyrogram.Venue>`, *optional*):
Message is a venue, information about the venue.
web_page (``bool``, *optional*):
Message was sent with a webpage preview.
**Note:** Support for web pages is still basic; a simple boolean is set in case the message contains a
web page preview. In future versions this property could turn into a full web page object that contains
more details.
new_chat_members (List of :obj:`User <pyrogram.User>`, *optional*):
New members that were added to the group or supergroup and information about them
(the bot itself may be one of these members).
@ -246,6 +252,7 @@ class Message(Object):
contact=None,
location=None,
venue=None,
web_page=None,
new_chat_members: list = None,
left_chat_member=None,
new_chat_title: str = None,
@ -297,6 +304,7 @@ class Message(Object):
self.contact = contact # flags.22?Contact
self.location = location # flags.23?Location
self.venue = venue # flags.24?Venue
self.web_page = web_page
self.new_chat_members = new_chat_members # flags.25?Vector<User>
self.left_chat_member = left_chat_member # flags.26?User
self.new_chat_title = new_chat_title # flags.27?string