Use this method to send photos. .. seealso:: :wiki:`Working with Files and Media ` Args: chat_id (:obj:`int` | :obj:`str`): |chat_id_channel| photo (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes`
(
self,
chat_id: int | str,
photo: "FileInput | PhotoSize",
caption: str | None = None,
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_markup: "ReplyMarkup | None" = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Sequence["MessageEntity"] | None = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
message_thread_id: int | None = None,
has_spoiler: bool | None = None,
reply_parameters: "ReplyParameters | None" = None,
business_connection_id: str | None = None,
message_effect_id: str | None = None,
allow_paid_broadcast: bool | None = None,
show_caption_above_media: bool | None = None,
direct_messages_topic_id: int | None = None,
suggested_post_parameters: "SuggestedPostParameters | None" = None,
*,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int | None = None,
filename: str | None = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict | None = None,
)
| 1474 | return MessageId.de_list(result, self) |
| 1475 | |
| 1476 | async def send_photo( |
| 1477 | self, |
| 1478 | chat_id: int | str, |
| 1479 | photo: "FileInput | PhotoSize", |
| 1480 | caption: str | None = None, |
| 1481 | disable_notification: ODVInput[bool] = DEFAULT_NONE, |
| 1482 | reply_markup: "ReplyMarkup | None" = None, |
| 1483 | parse_mode: ODVInput[str] = DEFAULT_NONE, |
| 1484 | caption_entities: Sequence["MessageEntity"] | None = None, |
| 1485 | protect_content: ODVInput[bool] = DEFAULT_NONE, |
| 1486 | message_thread_id: int | None = None, |
| 1487 | has_spoiler: bool | None = None, |
| 1488 | reply_parameters: "ReplyParameters | None" = None, |
| 1489 | business_connection_id: str | None = None, |
| 1490 | message_effect_id: str | None = None, |
| 1491 | allow_paid_broadcast: bool | None = None, |
| 1492 | show_caption_above_media: bool | None = None, |
| 1493 | direct_messages_topic_id: int | None = None, |
| 1494 | suggested_post_parameters: "SuggestedPostParameters | None" = None, |
| 1495 | *, |
| 1496 | allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, |
| 1497 | reply_to_message_id: int | None = None, |
| 1498 | filename: str | None = None, |
| 1499 | read_timeout: ODVInput[float] = DEFAULT_NONE, |
| 1500 | write_timeout: ODVInput[float] = DEFAULT_NONE, |
| 1501 | connect_timeout: ODVInput[float] = DEFAULT_NONE, |
| 1502 | pool_timeout: ODVInput[float] = DEFAULT_NONE, |
| 1503 | api_kwargs: JSONDict | None = None, |
| 1504 | ) -> Message: |
| 1505 | """Use this method to send photos. |
| 1506 | |
| 1507 | .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>` |
| 1508 | |
| 1509 | Args: |
| 1510 | chat_id (:obj:`int` | :obj:`str`): |chat_id_channel| |
| 1511 | photo (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` \ |
| 1512 | | :class:`pathlib.Path` | :class:`telegram.PhotoSize`): Photo to send. |
| 1513 | |fileinput| |
| 1514 | Lastly you can pass an existing :class:`telegram.PhotoSize` object to send. |
| 1515 | |
| 1516 | Caution: |
| 1517 | * The photo must be at most 10MB in size. |
| 1518 | * The photo's width and height must not exceed 10000 in total. |
| 1519 | * Width and height ratio must be at most 20. |
| 1520 | |
| 1521 | .. versionchanged:: 13.2 |
| 1522 | Accept :obj:`bytes` as input. |
| 1523 | |
| 1524 | .. versionchanged:: 20.0 |
| 1525 | File paths as input is also accepted for bots *not* running in |
| 1526 | :paramref:`~telegram.Bot.local_mode`. |
| 1527 | caption (:obj:`str`, optional): Photo caption (may also be used when resending photos |
| 1528 | by file_id), 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` |
| 1529 | characters after entities parsing. |
| 1530 | parse_mode (:obj:`str`, optional): |parse_mode| |
| 1531 | caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |
| 1532 | |caption_entities| |
| 1533 |