MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / InputMediaPhoto

Class InputMediaPhoto

src/telegram/_files/inputmedia.py:553–667  ·  view source on GitHub ↗

Represents a photo to be sent. .. seealso:: :wiki:`Working with Files and Media ` Args: media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` | \ :class:`pathlib.Path` | :class:`telegram.PhotoSize`): File to

Source from the content-addressed store, hash-verified

551
552
553class InputMediaPhoto(InputMedia):
554 """Represents a photo to be sent.
555
556 .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
557
558 Args:
559 media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` | \
560 :class:`pathlib.Path` | :class:`telegram.PhotoSize`): File to send. |fileinputnopath|
561 Lastly you can pass an existing :class:`telegram.PhotoSize` object to send.
562
563 .. versionchanged:: 13.2
564 Accept :obj:`bytes` as input.
565 filename_depr (:obj:`str`, optional): Positional placeholder for keyword only parameter
566 :paramref:`filename`. For backward compatibility.
567
568 .. versionadded:: 22.8
569 .. deprecated:: 22.8
570 This parameter is deprecated, use :paramref:`filename` instead.
571 caption (:obj:`str`, optional ): Caption of the photo to be sent,
572 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
573 entities parsing.
574 parse_mode (:obj:`str`, optional): |parse_mode|
575 caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|
576
577 .. versionchanged:: 20.0
578 |sequenceclassargs|
579 has_spoiler (:obj:`bool`, optional): Pass :obj:`True`, if the photo needs to be covered
580 with a spoiler animation.
581
582 .. versionadded:: 20.0
583 show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med|
584
585 .. versionadded:: 21.3
586
587 Keyword Args:
588 filename (:obj:`str`, optional): Custom file name for the photo, when uploading a
589 new file. Convenience parameter, useful e.g. when sending files generated by the
590 :obj:`tempfile` module.
591
592 .. versionadded:: 13.1
593 .. versionchanged:: 22.8
594 This parameter is now keyword-only.
595
596 Attributes:
597 type (:obj:`str`): :tg-const:`telegram.constants.BaseInputMediaType.PHOTO`.
598 media (:obj:`str` | :class:`telegram.InputFile`): Photo to send.
599 caption (:obj:`str`): Optional. Caption of the photo to be sent,
600 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
601 after entities parsing.
602 parse_mode (:obj:`str`): Optional. |parse_mode|
603 caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
604
605 .. versionchanged:: 20.0
606
607 * |tupleclassattrs|
608 * |alwaystuple|
609 has_spoiler (:obj:`bool`): Optional. :obj:`True`, if the photo is covered with a
610 spoiler animation.

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…