LinkPreviewOptions

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

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.

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[source]

Optional. True, if the link preview is disabled.

Type:

bool

url[source]

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[source]

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[source]

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[source]

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