Skip to content
Back to top
View this page

# LinkPreviewOptions

class telegram.LinkPreviewOptions(is_disabled=None, url=None, prefer_small_media=None, prefer_large_media=None, show_above_text=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  Describes the options used for link preview generation.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `is_disabled`, `url`, `prefer_small_media`, `prefer_large_media`, and `show_above_text` are equal.

  Use In

  - `telegram.Bot.edit_message_text()`

  - `telegram.Bot.send_message()`

  Available In

  - `telegram.ExternalReplyInfo.link_preview_options`

  - `telegram.InputTextMessageContent.link_preview_options`

  - `telegram.Message.link_preview_options`

  - `telegram.ext.Defaults.link_preview_options`

  Added in version 20.8.

  Parameters:

    - is_disabled (`bool`, optional) – `True`, if the link preview is disabled.

    - url (`str`, optional) – The URL to use for the link preview. If empty, then the first URL found in the message text will be used.

    - prefer_small_media (`bool`, optional) – `True`, if the media in the link preview is supposed to be shrunk; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.

    - prefer_large_media (`bool`, optional) – `True`, if the media in the link preview is supposed to be enlarged; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.

    - show_above_text (`bool`, optional) – `True`, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text.

  is_disabled

    Optional. `True`, if the link preview is disabled.

    Type:

      `bool`

  url

    Optional. The URL to use for the link preview. If empty, then the first URL found in the message text will be used.

    Type:

      `str`

  prefer_small_media

    Optional. `True`, if the media in the link preview is supposed to be shrunk; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.

    Type:

      `bool`

  prefer_large_media

    Optional. `True`, if the media in the link preview is supposed to be enlarged; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.

    Type:

      `bool`

  show_above_text

    Optional. `True`, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text.

    Type:

      `bool`