PaidMediaPreview

class telegram.PaidMediaPreview(width=None, height=None, duration=None, *, api_kwargs=None)[source]

Bases: telegram.PaidMedia

The paid media isn’t available before the payment.

Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their width, height, and duration are equal.

Added in version 21.4.

Changed in version v22.2: As part of the migration to representing time periods using datetime.timedelta, equality comparison now considers integer durations and equivalent timedeltas as equal.

Parameters:
  • type (str) – Type of the paid media, always 'preview'.

  • width (int, optional) – Media width as defined by the sender.

  • height (int, optional) – Media height as defined by the sender.

  • duration (int | datetime.timedelta, optional) –

    Duration of the media in seconds as defined by the sender.

    Changed in version v22.2: datetime.timedelta objects are accepted in addition to plain int values.

type[source]

Type of the paid media, always 'preview'.

Type:

str

width[source]

Optional. Media width as defined by the sender.

Type:

int

height[source]

Optional. Media height as defined by the sender.

Type:

int

duration[source]

Optional. Duration of the media in seconds as defined by the sender.

Deprecated since version v22.2: In a future major version this attribute will be of type datetime.timedelta. You can opt-in early by setting PTB_TIMEDELTA=true or PTB_TIMEDELTA=1 as an environment variable.

Type:

int | datetime.timedelta