From 4112298666cc1240b915f5d65c0421020fcb40d3 Mon Sep 17 00:00:00 2001 From: wulan17 Date: Thu, 15 Aug 2024 00:03:11 +0700 Subject: [PATCH] pyrofork: Add support for question/options entities in Message.reply_poll bound method Signed-off-by: wulan17 --- pyrogram/types/messages_and_media/message.py | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index cd88d098..36d0b950 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -2913,7 +2913,8 @@ class Message(Object, Update): async def reply_poll( self, question: str, - options: List[str], + options: List["types.PollOption"], + question_entities: List["types.MessageEntity"] = None, is_anonymous: bool = True, type: "enums.PollType" = enums.PollType.REGULAR, allows_multiple_answers: bool = None, @@ -2950,20 +2951,34 @@ class Message(Object, Update): await client.send_poll( chat_id=message.chat.id, question="This is a poll", - options=["A", "B", "C] + options=[ + PollOption("A"), + PollOption("B"), + PollOption("C") + ] ) Example: .. code-block:: python - await message.reply_poll("This is a poll", ["A", "B", "C"]) + await message.reply_poll( + "This is a poll", + [ + PollOption("A"), + PollOption("B"), + PollOption("C") + ] + ) Parameters: question (``str``): Poll question, 1-255 characters. - options (List of ``str``): - List of answer options, 2-10 strings 1-100 characters each. + options (List of :obj:`~pyrogram.types.PollOption`): + List of PollOption. + + question_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*): + List of special entities that appear in the poll question, which can be specified instead of *parse_mode*. is_anonymous (``bool``, *optional*): True, if the poll needs to be anonymous. @@ -3077,6 +3092,7 @@ class Message(Object, Update): chat_id=chat_id, question=question, options=options, + question_entities=question_entities, is_anonymous=is_anonymous, type=type, allows_multiple_answers=allows_multiple_answers,