@@ -31,7 +31,7 @@ async def send_poll(
3131 chat_id : Union [int , str ],
3232 question : Union [str , "types.FormattedText" ],
3333 options : List [Union [str , "types.InputPollOption" ]],
34- media : Optional ["types.InputMedia" ] = None ,
34+ description_media : Optional ["types.InputMedia" ] = None ,
3535 message_thread_id : Optional [int ] = None ,
3636 business_connection_id : Optional [str ] = None ,
3737 is_anonymous : bool = True ,
@@ -43,6 +43,7 @@ async def send_poll(
4343 hide_results_until_closes : Optional [bool ] = None ,
4444 correct_option_ids : Optional [List [int ]] = None ,
4545 explanation : Optional [Union [str , "types.FormattedText" ]] = None ,
46+ explanation_media : Optional ["types.InputMedia" ] = None ,
4647 open_period : Optional [int ] = None ,
4748 close_date : Optional [datetime ] = None ,
4849 is_closed : Optional [bool ] = None ,
@@ -86,9 +87,8 @@ async def send_poll(
8687 options (List of :obj:`~pyrogram.types.InputPollOption`):
8788 List of 2-12 answer options.
8889
89- media (:obj:`~pyrogram.types.InputMediaPhoto` | :obj:`~pyrogram.types.InputMediaVideo` | :obj:`~pyrogram.types.InputMediaSticker ` | :obj:`~pyrogram.types.Location`, *optional*):
90+ explanation_media (:obj:`~pyrogram.types.InputMedia ` | :obj:`~pyrogram.types.Location`, *optional*):
9091 Media attached to the poll.
91- Currently supports only photo, video, sticker or location.
9292
9393 message_thread_id (``int``, *optional*):
9494 Unique identifier for the target message thread (topic) of the forum.
@@ -128,6 +128,9 @@ async def send_poll(
128128 explanation (``str`` | :obj:`~pyrogram.types.FormattedText`, *optional*):
129129 Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing.
130130
131+ explanation_media (:obj:`~pyrogram.types.InputMedia` | :obj:`~pyrogram.types.Location`, *optional*):
132+ Media attached to the explanation.
133+
131134 open_period (``int``, *optional*):
132135 Amount of time in seconds the poll will be active after creation, 5-2628000.
133136 Can't be used together with *close_date*.
@@ -199,7 +202,7 @@ async def send_poll(
199202 await app.send_poll(
200203 chat_id=chat_id,
201204 question="Where we are?",
202- media =types.InputMediaPhoto("photo.jpg"),
205+ description_media =types.InputMediaPhoto("photo.jpg"),
203206 options=[
204207 types.InputPollOption(
205208 text="Maybe here?",
@@ -208,24 +211,13 @@ async def send_poll(
208211 types.InputPollOption(
209212 text="Or here?",
210213 media=types.Location(
211- longitude =49.807760,
212- latitude =73.088504
214+ latitude =49.807760,
215+ longitude =73.088504
213216 ),
214217 ),
215218 ]
216219 )
217220 """
218- if media is not None and not isinstance (
219- media ,
220- (
221- types .InputMediaPhoto ,
222- types .InputMediaVideo ,
223- types .InputMediaSticker ,
224- types .Location ,
225- ),
226- ):
227- raise ValueError ("Unsupported media type" )
228-
229221 if isinstance (question , str ):
230222 question = types .FormattedText (text = question )
231223
@@ -283,9 +275,10 @@ async def send_poll(
283275 close_date = utils .datetime_to_timestamp (close_date )
284276 ),
285277 correct_answers = correct_option_ids ,
286- attached_media = await media .write (client = self ) if media is not None else None ,
278+ attached_media = await description_media .write (client = self ) if description_media is not None else None ,
287279 solution = solution ,
288- solution_entities = solution_entities
280+ solution_entities = solution_entities ,
281+ solution_media = await explanation_media .write (client = self ) if explanation_media is not None else None
289282 ),
290283 message = message or "" ,
291284 entities = entities or None ,
0 commit comments