Skip to content

Commit a8cd18e

Browse files
Add bound method stop() to the Poll object.
1 parent b66334f commit a8cd18e

File tree

1 file changed

+37
-0
lines changed
  • pyrogram/types/messages_and_media

1 file changed

+37
-0
lines changed

pyrogram/types/messages_and_media/poll.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,40 @@ def _parse_update(client, update: "raw.types.UpdateMessagePoll"):
155155
chosen_option=chosen_option,
156156
client=client
157157
)
158+
159+
async def stop(
160+
self,
161+
reply_markup: "types.InlineKeyboardMarkup" = None
162+
) -> "types.Poll":
163+
"""Bound method *stop* of :obj:`~pyrogram.types.Poll`.
164+
165+
Use as a shortcut for:
166+
167+
.. code-block:: python
168+
169+
client.stop_poll(
170+
chat_id=message.chat.id,
171+
message_id=message.id,
172+
)
173+
174+
Parameters:
175+
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
176+
An InlineKeyboardMarkup object.
177+
178+
Example:
179+
.. code-block:: python
180+
181+
message.poll.stop()
182+
183+
Returns:
184+
:obj:`~pyrogram.types.Poll`: On success, the stopped poll with the final results is returned.
185+
186+
Raises:
187+
RPCError: In case of a Telegram RPC error.
188+
"""
189+
190+
return await self._client.stop_poll(
191+
chat_id=self.chat.id,
192+
message_id=self.id,
193+
reply_markup=reply_markup
194+
)

0 commit comments

Comments
 (0)