Parse Poll objects inside Message

This commit is contained in:
Dan 2018-12-22 23:55:04 +01:00
parent 1ef3bc758f
commit 2b25b9469b

View File

@ -262,6 +262,7 @@ class Message(PyrogramType):
location: "pyrogram.Location" = None, location: "pyrogram.Location" = None,
venue: "pyrogram.Venue" = None, venue: "pyrogram.Venue" = None,
web_page: bool = None, web_page: bool = None,
poll: "pyrogram.Poll" = None,
new_chat_members: List[User] = None, new_chat_members: List[User] = None,
left_chat_member: User = None, left_chat_member: User = None,
new_chat_title: str = None, new_chat_title: str = None,
@ -317,6 +318,7 @@ class Message(PyrogramType):
self.location = location self.location = location
self.venue = venue self.venue = venue
self.web_page = web_page self.web_page = web_page
self.poll = poll
self.new_chat_members = new_chat_members self.new_chat_members = new_chat_members
self.left_chat_member = left_chat_member self.left_chat_member = left_chat_member
self.new_chat_title = new_chat_title self.new_chat_title = new_chat_title
@ -440,6 +442,7 @@ class Message(PyrogramType):
sticker = None sticker = None
document = None document = None
web_page = None web_page = None
poll = None
media = message.media media = message.media
@ -494,6 +497,8 @@ class Message(PyrogramType):
elif isinstance(media, types.MessageMediaWebPage): elif isinstance(media, types.MessageMediaWebPage):
web_page = True web_page = True
media = None media = None
elif isinstance(media, types.MessageMediaPoll):
poll = pyrogram.Poll._parse(client, media)
else: else:
media = None media = None
@ -542,6 +547,7 @@ class Message(PyrogramType):
sticker=sticker, sticker=sticker,
document=document, document=document,
web_page=web_page, web_page=web_page,
poll=poll,
views=message.views, views=message.views,
via_bot=User._parse(client, users.get(message.via_bot_id, None)), via_bot=User._parse(client, users.get(message.via_bot_id, None)),
outgoing=message.out, outgoing=message.out,