Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/source/telegram.at-tree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ Available Types
telegram.messageoriginuser
telegram.messagereactioncountupdated
telegram.messagereactionupdated
telegram.paidmedia
telegram.paidmediainfo
telegram.paidmediaphoto
telegram.paidmediapreview
telegram.paidmediavideo
telegram.photosize
telegram.poll
telegram.pollanswer
Expand Down
6 changes: 6 additions & 0 deletions docs/source/telegram.paidmedia.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PaidMedia
=========

.. autoclass:: telegram.PaidMedia
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.paidmediainfo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PaidMediaInfo
=============

.. autoclass:: telegram.PaidMediaInfo
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.paidmediaphoto.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PaidMediaPhoto
==============

.. autoclass:: telegram.PaidMediaPhoto
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.paidmediapreview.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PaidMediaPreview
================

.. autoclass:: telegram.PaidMediaPreview
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.paidmediavideo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PaidMediaVideo
==============

.. autoclass:: telegram.PaidMediaVideo
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@
"MessageReactionCountUpdated",
"MessageReactionUpdated",
"OrderInfo",
"PaidMedia",
"PaidMediaInfo",
"PaidMediaPhoto",
"PaidMediaPreview",
"PaidMediaVideo",
"PassportData",
"PassportElementError",
"PassportElementErrorDataField",
Expand Down Expand Up @@ -405,6 +410,7 @@
MessageOriginUser,
)
from ._messagereactionupdated import MessageReactionCountUpdated, MessageReactionUpdated
from ._paidmedia import PaidMedia, PaidMediaInfo, PaidMediaPhoto, PaidMediaPreview, PaidMediaVideo
from ._passport.credentials import (
Credentials,
DataCredentials,
Expand Down
18 changes: 18 additions & 0 deletions telegram/_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
from telegram._linkpreviewoptions import LinkPreviewOptions
from telegram._messageautodeletetimerchanged import MessageAutoDeleteTimerChanged
from telegram._messageentity import MessageEntity
from telegram._paidmedia import PaidMediaInfo
from telegram._passport.passportdata import PassportData
from telegram._payment.invoice import Invoice
from telegram._payment.successfulpayment import SuccessfulPayment
Expand Down Expand Up @@ -571,6 +572,10 @@ class Message(MaybeInaccessibleMessage):
background set.

.. versionadded:: 21.2
paid_media (:obj:`telegram.PaidMediaInfo`, optional): Message contains paid media;
information about the paid media.

.. versionadded:: NEXT.VERSION

Attributes:
message_id (:obj:`int`): Unique message identifier inside this chat.
Expand Down Expand Up @@ -884,6 +889,10 @@ class Message(MaybeInaccessibleMessage):
background set

.. versionadded:: 21.2
paid_media (:obj:`telegram.PaidMediaInfo`): Optional. Message contains paid media;
information about the paid media.

.. versionadded:: NEXT.VERSION

.. |custom_emoji_no_md1_support| replace:: Since custom emoji entities are not supported by
:attr:`~telegram.constants.ParseMode.MARKDOWN`, this method now raises a
Expand Down Expand Up @@ -950,6 +959,7 @@ class Message(MaybeInaccessibleMessage):
"new_chat_members",
"new_chat_photo",
"new_chat_title",
"paid_media",
"passport_data",
"photo",
"pinned_message",
Expand Down Expand Up @@ -1067,6 +1077,7 @@ def __init__(
chat_background_set: Optional[ChatBackground] = None,
effect_id: Optional[str] = None,
show_caption_above_media: Optional[bool] = None,
paid_media: Optional[PaidMediaInfo] = None,
*,
api_kwargs: Optional[JSONDict] = None,
):
Expand Down Expand Up @@ -1168,6 +1179,7 @@ def __init__(
self.chat_background_set: Optional[ChatBackground] = chat_background_set
self.effect_id: Optional[str] = effect_id
self.show_caption_above_media: Optional[bool] = show_caption_above_media
self.paid_media: Optional[PaidMediaInfo] = paid_media

self._effective_attachment = DEFAULT_NONE

Expand Down Expand Up @@ -1283,6 +1295,7 @@ def de_json(cls, data: Optional[JSONDict], bot: Optional["Bot"] = None) -> Optio
data["users_shared"] = UsersShared.de_json(data.get("users_shared"), bot)
data["chat_shared"] = ChatShared.de_json(data.get("chat_shared"), bot)
data["chat_background_set"] = ChatBackground.de_json(data.get("chat_background_set"), bot)
data["paid_media"] = PaidMediaInfo.de_json(data.get("paid_media"), bot)

# Unfortunately, this needs to be here due to cyclic imports
from telegram._giveaway import ( # pylint: disable=import-outside-toplevel
Expand Down Expand Up @@ -1346,6 +1359,7 @@ def effective_attachment(
Location,
PassportData,
Sequence[PhotoSize],
PaidMediaInfo,
Poll,
Sticker,
Story,
Expand All @@ -1369,6 +1383,7 @@ def effective_attachment(
* :class:`telegram.Location`
* :class:`telegram.PassportData`
* List[:class:`telegram.PhotoSize`]
* :class:`telegram.PaidMediaInfo`
* :class:`telegram.Poll`
* :class:`telegram.Sticker`
* :class:`telegram.Story`
Expand All @@ -1386,6 +1401,9 @@ def effective_attachment(
:attr:`dice`, :attr:`passport_data` and :attr:`poll` are now also considered to be an
attachment.

.. versionchanged:: NEXT.VERSION
:attr:`paid_media` is now also considered to be an attachment.

"""
if not isinstance(self._effective_attachment, DefaultValue):
return self._effective_attachment
Expand Down
Loading