Skip to content

Commit 2095f9f

Browse files
authored
Add bound method vote to Message
1 parent 5599182 commit 2095f9f

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

  • pyrogram/client/types/messages_and_media

pyrogram/client/types/messages_and_media/message.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,6 +2923,43 @@ def download(
29232923
progress=progress,
29242924
progress_args=progress_args,
29252925
)
2926+
def vote(
2927+
self,
2928+
option: int,
2929+
) -> "Poll":
2930+
"""Bound method *vote* of :obj:`Message`.
2931+
2932+
Use as a shortcut for:
2933+
2934+
.. code-block:: python
2935+
2936+
client.vote_poll(
2937+
chat_id=message.chat.id,
2938+
message_id=message.message_id,
2939+
option=1
2940+
)
2941+
2942+
Example:
2943+
.. code-block:: python
2944+
2945+
message.vote(6)
2946+
2947+
Parameters:
2948+
option (``int``):
2949+
Index of the poll option you want to vote for (0 to 9).
2950+
2951+
Returns:
2952+
On success, the poll with the chosen option is returned.
2953+
2954+
Raises:
2955+
RPCError: In case of a Telegram RPC error.
2956+
"""
2957+
2958+
return self._client.vote_poll(
2959+
chat_id=self.chat.id,
2960+
message_id= self.message_id,
2961+
option=option
2962+
)
29262963

29272964
def pin(self, disable_notification: bool = None) -> "Message":
29282965
"""Bound method *pin* of :obj:`Message`.

0 commit comments

Comments
 (0)