@@ -29,78 +29,80 @@ class Poll(PyrogramType):
2929
3030 Args:
3131 id (``int``):
32- The poll id in this chat.
33-
34- closed (``bool``):
35- Whether the poll is closed or not.
32+ Unique poll identifier.
3633
3734 question (``str``):
38- Poll question.
35+ Poll question, 1-255 characters .
3936
4037 options (List of :obj:`PollOption`):
41- The available poll options.
38+ List of poll options.
39+
40+ is_closed (``bool``):
41+ True, if the poll is closed.
4242
4343 total_voters (``int``):
44- Total amount of voters for this poll.
44+ Total count of voters for this poll.
4545
46- option_chosen (``int``, *optional*):
47- The index of your chosen option (in case you voted already), None otherwise .
46+ chosen_option (``int``, *optional*):
47+ Index of your chosen option (0-9), None in case you haven't voted yet .
4848 """
4949
50- __slots__ = ["id" , "closed " , "question " , "options " , "total_voters" , "option_chosen " ]
50+ __slots__ = ["id" , "question " , "options " , "is_closed " , "total_voters" , "chosen_option " ]
5151
5252 def __init__ (
5353 self ,
5454 * ,
5555 client : "pyrogram.client.ext.BaseClient" ,
5656 id : int ,
57- closed : bool ,
5857 question : str ,
5958 options : List [PollOption ],
59+ is_closed : bool ,
6060 total_voters : int ,
61- option_chosen : int = None
61+ chosen_option : int = None
6262 ):
6363 super ().__init__ (client )
6464
6565 self .id = id
66- self .closed = closed
6766 self .question = question
6867 self .options = options
68+ self .is_closed = is_closed
6969 self .total_voters = total_voters
70- self .option_chosen = option_chosen
70+ self .chosen_option = chosen_option
7171
7272 @staticmethod
7373 def _parse (client , media_poll : types .MessageMediaPoll ) -> "Poll" :
7474 poll = media_poll .poll
7575 results = media_poll .results .results
7676 total_voters = media_poll .results .total_voters
77- option_chosen = None
77+ chosen_option = None
7878
7979 options = []
8080
8181 for i , answer in enumerate (poll .answers ):
82- voters = 0
82+ voter_count = 0
8383
8484 if results :
8585 result = results [i ]
86- voters = result .voters
86+ voter_count = result .voters
8787
8888 if result .chosen :
89- option_chosen = i
89+ chosen_option = i
9090
91- options .append (PollOption (
92- text = answer .text ,
93- voters = voters ,
94- data = answer .option ,
95- client = client
96- ))
91+ options .append (
92+ PollOption (
93+ text = answer .text ,
94+ voter_count = voter_count ,
95+ data = answer .option ,
96+ client = client
97+ )
98+ )
9799
98100 return Poll (
99101 id = poll .id ,
100- closed = poll .closed ,
101102 question = poll .question ,
102103 options = options ,
104+ is_closed = poll .closed ,
103105 total_voters = total_voters ,
104- option_chosen = option_chosen ,
106+ chosen_option = chosen_option ,
105107 client = client
106108 )
0 commit comments