InputRichMessageMedia

class pyrogram.types.InputRichMessageMedia[source]

Describes media referenced in a rich message.

There are two ways a rich message refers to media, and this object covers both.

By identifier, for html and markdown content: set id and media, and refer to it from the text as tg://photo?id=<id>, tg://video?id=<id> or tg://audio?id=<id>.

By position, for blocks content: set photos, documents and users, which the block objects index into (the photo_id of an InputRichBlockPhoto must match the id attribute of the corresponding InputPhoto). MTProto has no identifiers on this side, which is why the two shapes differ.

Parameters:
  • id (str, optional) – Unique identifier of the media used in a tg://photo?id=, tg://video?id= or tg://audio?id= link. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.

  • media (str | InputPhoto | InputDocument, optional) – The media the identifier refers to, as a file identifier of an already uploaded file or as an input photo or document. A rich message can only refer to media that already exists on Telegram, so a local path or an HTTP URL has to be uploaded first.

  • photos (List of InputPhoto, optional) – Photos referenced by blocks.

  • documents (List of InputDocument, optional) – Documents referenced by blocks.

  • users (List of InputUser, optional) – Users referenced by blocks.