Skip to content

Commit 8a83bf1

Browse files
New-dev0alissonlauffer
authored andcommitted
Add bound method stop() to the Poll object
1 parent cfb4cd9 commit 8a83bf1

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

  • pyrogram/types/messages_and_media

pyrogram/types/messages_and_media/poll.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,40 @@ def _parse_update(client, update: "raw.types.UpdateMessagePoll"):
201201
correct_option_id=correct_option_id,
202202
client=client
203203
)
204+
205+
async def stop(
206+
self,
207+
reply_markup: "types.InlineKeyboardMarkup" = None
208+
) -> "types.Poll":
209+
"""Bound method *stop* of :obj:`~pyrogram.types.Poll`.
210+
211+
Use as a shortcut for:
212+
213+
.. code-block:: python
214+
215+
client.stop_poll(
216+
chat_id=message.chat.id,
217+
message_id=message.id,
218+
)
219+
220+
Parameters:
221+
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
222+
An InlineKeyboardMarkup object.
223+
224+
Example:
225+
.. code-block:: python
226+
227+
message.poll.stop()
228+
229+
Returns:
230+
:obj:`~pyrogram.types.Poll`: On success, the stopped poll with the final results is returned.
231+
232+
Raises:
233+
RPCError: In case of a Telegram RPC error.
234+
"""
235+
236+
return await self._client.stop_poll(
237+
chat_id=self.chat.id,
238+
message_id=self.id,
239+
reply_markup=reply_markup
240+
)

0 commit comments

Comments
 (0)