From 2994929903aeee20ddc56a74bd05d5cfbdf02640 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 23 Dec 2018 16:59:45 +0100 Subject: [PATCH] Document Poll --- .../client/types/messages_and_media/poll.py | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/pyrogram/client/types/messages_and_media/poll.py b/pyrogram/client/types/messages_and_media/poll.py index 42ba8640..9e1f481d 100644 --- a/pyrogram/client/types/messages_and_media/poll.py +++ b/pyrogram/client/types/messages_and_media/poll.py @@ -38,6 +38,28 @@ class PollOption(PyrogramType): class Poll(PyrogramType): + """This object represents a Poll + + Args: + id (``int``): + The poll id in this chat. + + closed (``bool``): + Whether the poll is closed or not. + + question (``str``): + Poll question + + options (List of :obj:`PollOption`): + The available poll options. + + total_voters (``int``): + Total amount of voters for this poll. + + option_chosen (``int``, *optional*): + The index of your chosen option (in case you voted already), None otherwise. + """ + def __init__(self, *, client: "pyrogram.client.ext.BaseClient", @@ -45,16 +67,16 @@ class Poll(PyrogramType): closed: bool, question: str, options: List[PollOption], - option_chosen: int = None, - total_voters: int): + total_voters: int, + option_chosen: int = None): super().__init__(client) self.id = id self.closed = closed self.question = question self.options = options - self.option_chosen = option_chosen self.total_voters = total_voters + self.option_chosen = option_chosen @staticmethod def _parse(client, media_poll: types.MessageMediaPoll) -> "Poll": @@ -87,7 +109,7 @@ class Poll(PyrogramType): closed=poll.closed, question=poll.question, options=options, - option_chosen=option_chosen, total_voters=total_voters, + option_chosen=option_chosen, client=client )