Add the field has_spoiler to relevant InputMedia* classes

- InputMediaPhoto
- InputMediaVideo
- InputMediaAnimation
This commit is contained in:
Dan 2022-12-30 15:10:20 +01:00
parent 06996d24ff
commit a116ea42c8
3 changed files with 19 additions and 3 deletions

View File

@ -59,6 +59,9 @@ class InputMediaAnimation(InputMedia):
duration (``int``, *optional*):
Animation duration.
has_spoiler (``bool``, *optional*):
Pass True if the photo needs to be covered with a spoiler animation.
"""
def __init__(
@ -70,7 +73,8 @@ class InputMediaAnimation(InputMedia):
caption_entities: List[MessageEntity] = None,
width: int = 0,
height: int = 0,
duration: int = 0
duration: int = 0,
has_spoiler: bool = None
):
super().__init__(media, caption, parse_mode, caption_entities)
@ -78,3 +82,4 @@ class InputMediaAnimation(InputMedia):
self.width = width
self.height = height
self.duration = duration
self.has_spoiler = has_spoiler

View File

@ -45,6 +45,9 @@ class InputMediaPhoto(InputMedia):
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
has_spoiler (``bool``, *optional*):
Pass True if the photo needs to be covered with a spoiler animation.
"""
def __init__(
@ -52,6 +55,9 @@ class InputMediaPhoto(InputMedia):
media: Union[str, BinaryIO],
caption: str = "",
parse_mode: Optional["enums.ParseMode"] = None,
caption_entities: List[MessageEntity] = None
caption_entities: List[MessageEntity] = None,
has_spoiler: bool = None
):
super().__init__(media, caption, parse_mode, caption_entities)
self.has_spoiler = has_spoiler

View File

@ -63,6 +63,9 @@ class InputMediaVideo(InputMedia):
supports_streaming (``bool``, *optional*):
Pass True, if the uploaded video is suitable for streaming.
has_spoiler (``bool``, *optional*):
Pass True if the photo needs to be covered with a spoiler animation.
"""
def __init__(
@ -75,7 +78,8 @@ class InputMediaVideo(InputMedia):
width: int = 0,
height: int = 0,
duration: int = 0,
supports_streaming: bool = True
supports_streaming: bool = True,
has_spoiler: bool = None,
):
super().__init__(media, caption, parse_mode, caption_entities)
@ -84,3 +88,4 @@ class InputMediaVideo(InputMedia):
self.height = height
self.duration = duration
self.supports_streaming = supports_streaming
self.has_spoiler = has_spoiler