mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-30 13:57:54 +00:00
Document Poll
This commit is contained in:
parent
03d6c49d92
commit
2994929903
@ -38,6 +38,28 @@ class PollOption(PyrogramType):
|
|||||||
|
|
||||||
|
|
||||||
class Poll(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,
|
def __init__(self,
|
||||||
*,
|
*,
|
||||||
client: "pyrogram.client.ext.BaseClient",
|
client: "pyrogram.client.ext.BaseClient",
|
||||||
@ -45,16 +67,16 @@ class Poll(PyrogramType):
|
|||||||
closed: bool,
|
closed: bool,
|
||||||
question: str,
|
question: str,
|
||||||
options: List[PollOption],
|
options: List[PollOption],
|
||||||
option_chosen: int = None,
|
total_voters: int,
|
||||||
total_voters: int):
|
option_chosen: int = None):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
|
|
||||||
self.id = id
|
self.id = id
|
||||||
self.closed = closed
|
self.closed = closed
|
||||||
self.question = question
|
self.question = question
|
||||||
self.options = options
|
self.options = options
|
||||||
self.option_chosen = option_chosen
|
|
||||||
self.total_voters = total_voters
|
self.total_voters = total_voters
|
||||||
|
self.option_chosen = option_chosen
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse(client, media_poll: types.MessageMediaPoll) -> "Poll":
|
def _parse(client, media_poll: types.MessageMediaPoll) -> "Poll":
|
||||||
@ -87,7 +109,7 @@ class Poll(PyrogramType):
|
|||||||
closed=poll.closed,
|
closed=poll.closed,
|
||||||
question=poll.question,
|
question=poll.question,
|
||||||
options=options,
|
options=options,
|
||||||
option_chosen=option_chosen,
|
|
||||||
total_voters=total_voters,
|
total_voters=total_voters,
|
||||||
|
option_chosen=option_chosen,
|
||||||
client=client
|
client=client
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user