Add the parameter has_spoiler to relevant send_* media methods · pythonfansx/pyrogram@c707a4b · GitHub
Skip to content

Commit c707a4b

Browse files
committed
Add the parameter has_spoiler to relevant send_* media methods
- send_photo() - send_video() - send_animation()
1 parent ef29b3c commit c707a4b

3 files changed

Lines changed: 26 additions & 5 deletions

File tree

pyrogram/methods/messages/send_animation.py

Lines changed: 8 additions & 1 deletion

pyrogram/methods/messages/send_photo.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ async def send_photo(
3737
caption: str = "",
3838
parse_mode: Optional["enums.ParseMode"] = None,
3939
caption_entities: List["types.MessageEntity"] = None,
40+
has_spoiler: bool = None,
4041
ttl_seconds: int = None,
4142
disable_notification: bool = None,
4243
reply_to_message_id: int = None,
@@ -78,6 +79,9 @@ async def send_photo(
7879
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
7980
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
8081
82+
has_spoiler (``bool``, *optional*):
83+
Pass True if the photo needs to be covered with a spoiler animation.
84+
8185
ttl_seconds (``int``, *optional*):
8286
Self-Destruct Timer.
8387
If you set a timer, the photo will self-destruct in *ttl_seconds*
@@ -149,20 +153,23 @@ async def send_photo(
149153
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
150154
media = raw.types.InputMediaUploadedPhoto(
151155
file=file,
152-
ttl_seconds=ttl_seconds
156+
ttl_seconds=ttl_seconds,
157+
spoiler=has_spoiler,
153158
)
154159
elif re.match("^https?://", photo):
155160
media = raw.types.InputMediaPhotoExternal(
156161
url=photo,
157-
ttl_seconds=ttl_seconds
162+
ttl_seconds=ttl_seconds,
163+
spoiler=has_spoiler
158164
)
159165
else:
160166
media = utils.get_input_media_from_file_id(photo, FileType.PHOTO, ttl_seconds=ttl_seconds)
161167
else:
162168
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
163169
media = raw.types.InputMediaUploadedPhoto(
164170
file=file,
165-
ttl_seconds=ttl_seconds
171+
ttl_seconds=ttl_seconds,
172+
spoiler=has_spoiler
166173
)
167174

168175
while True:

pyrogram/methods/messages/send_video.py

Lines changed: 8 additions & 1 deletion

0 commit comments

Comments
 (0)