MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / PaidMediaPhoto

Class PaidMediaPhoto

src/telegram/_paidmedia.py:176–214  ·  view source on GitHub ↗

The paid media is a photo. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`photo` are equal. .. versionadded:: 21.4 Args: type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.P

Source from the content-addressed store, hash-verified

174
175
176class PaidMediaPhoto(PaidMedia):
177 """
178 The paid media is a photo.
179
180 Objects of this class are comparable in terms of equality. Two objects of this class are
181 considered equal, if their :attr:`photo` are equal.
182
183 .. versionadded:: 21.4
184
185 Args:
186 type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PHOTO`.
187 photo (Sequence[:class:`telegram.PhotoSize`]): The photo.
188
189 Attributes:
190 type (:obj:`str`): Type of the paid media, always :tg-const:`telegram.PaidMedia.PHOTO`.
191 photo (tuple[:class:`telegram.PhotoSize`]): The photo.
192 """
193
194 __slots__ = ("photo",)
195
196 def __init__(
197 self,
198 photo: Sequence["PhotoSize"],
199 *,
200 api_kwargs: JSONDict | None = None,
201 ) -> None:
202 super().__init__(type=PaidMedia.PHOTO, api_kwargs=api_kwargs)
203
204 with self._unfrozen():
205 self.photo: tuple[PhotoSize, ...] = parse_sequence_arg(photo)
206
207 self._id_attrs = (self.type, self.photo)
208
209 @classmethod
210 def de_json(cls, data: JSONDict, bot: "Bot | None" = None) -> "PaidMediaPhoto":
211 data = cls._parse_data(data)
212
213 data["photo"] = de_list_optional(data.get("photo"), PhotoSize, bot)
214 return super().de_json(data=data, bot=bot) # type: ignore[return-value]
215
216
217class PaidMediaVideo(PaidMedia):

Callers 3

paid_media_photoFunction · 0.90
test_equalityMethod · 0.90

Calls

no outgoing calls

Tested by 2

paid_media_photoFunction · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…