mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +00:00
Rework vote_poll to work with all polls generated by different clients
This commit is contained in:
parent
1f82eaa26f
commit
10f1e06326
@ -28,11 +28,13 @@ class VotePoll(BaseClient):
|
||||
chat_id: Union[int, str],
|
||||
message_id: id,
|
||||
option: int) -> bool:
|
||||
poll = self.get_messages(chat_id, message_id).poll
|
||||
|
||||
self.send(
|
||||
functions.messages.SendVote(
|
||||
peer=self.resolve_peer(chat_id),
|
||||
msg_id=message_id,
|
||||
options=[bytes([option])]
|
||||
options=[poll.options[option]._data]
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -28,11 +28,13 @@ class PollOption(PyrogramType):
|
||||
*,
|
||||
client: "pyrogram.client.ext.BaseClient",
|
||||
text: str,
|
||||
voters: int):
|
||||
voters: int,
|
||||
data: bytes):
|
||||
super().__init__(client)
|
||||
|
||||
self.text = text
|
||||
self.voters = voters
|
||||
self._data = data
|
||||
|
||||
|
||||
class Poll(PyrogramType):
|
||||
@ -76,6 +78,7 @@ class Poll(PyrogramType):
|
||||
options.append(PollOption(
|
||||
text=answer.text,
|
||||
voters=voters,
|
||||
data=answer.option,
|
||||
client=client
|
||||
))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user