From e760550f8b443cf67289d11106eab3bff940593d Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 8 Nov 2018 10:49:32 +0100 Subject: [PATCH] Add Message.media field --- pyrogram/client/ext/utils.py | 1 + pyrogram/client/types/messages_and_media/message.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py index 3df2a450..218655f4 100644 --- a/pyrogram/client/ext/utils.py +++ b/pyrogram/client/ext/utils.py @@ -607,6 +607,7 @@ def parse_messages( forward_signature=forward_signature, forward_date=forward_date, mentioned=message.mentioned, + media=bool(media) or None, edit_date=message.edit_date, media_group_id=message.grouped_id, photo=photo, diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 12f3116a..ffcab6f3 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -68,6 +68,11 @@ class Message(Object): new_chat_photo, delete_chat_photo, group_chat_created, supergroup_chat_created, channel_chat_created, migrate_to_chat_id, migrate_from_chat_id, pinned_message. + media (``bool``` *optional*): + The message is a media message. + A media message has one and only one of these fields set: audio, document, photo, sticker, video, animation, + voice, video_note, contact, location, venue. + edit_date (``int``, *optional*): Date the message was last edited in Unix time. @@ -222,6 +227,7 @@ class Message(Object): mentioned=None, empty=None, service=None, + media=None, edit_date: int = None, media_group_id: str = None, author_signature: str = None, @@ -272,6 +278,7 @@ class Message(Object): self.mentioned = mentioned self.empty = empty self.service = service + self.media = media self.edit_date = edit_date # flags.7?int self.media_group_id = media_group_id # flags.8?string self.author_signature = author_signature # flags.9?string