From 2b25b9469ba59fc61cef2f6c6d92efdec9717cc6 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 22 Dec 2018 23:55:04 +0100 Subject: [PATCH] Parse Poll objects inside Message --- pyrogram/client/types/messages_and_media/message.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 25c35456..baeac31f 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -262,6 +262,7 @@ class Message(PyrogramType): location: "pyrogram.Location" = None, venue: "pyrogram.Venue" = None, web_page: bool = None, + poll: "pyrogram.Poll" = None, new_chat_members: List[User] = None, left_chat_member: User = None, new_chat_title: str = None, @@ -317,6 +318,7 @@ class Message(PyrogramType): self.location = location self.venue = venue self.web_page = web_page + self.poll = poll self.new_chat_members = new_chat_members self.left_chat_member = left_chat_member self.new_chat_title = new_chat_title @@ -440,6 +442,7 @@ class Message(PyrogramType): sticker = None document = None web_page = None + poll = None media = message.media @@ -494,6 +497,8 @@ class Message(PyrogramType): elif isinstance(media, types.MessageMediaWebPage): web_page = True media = None + elif isinstance(media, types.MessageMediaPoll): + poll = pyrogram.Poll._parse(client, media) else: media = None @@ -542,6 +547,7 @@ class Message(PyrogramType): sticker=sticker, document=document, web_page=web_page, + poll=poll, views=message.views, via_bot=User._parse(client, users.get(message.via_bot_id, None)), outgoing=message.out,