mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Add the parameter has_spoiler to relevant send_* media methods
- send_photo() - send_video() - send_animation()
This commit is contained in:
parent
b865512c68
commit
65b045ff2d
3 changed files with 26 additions and 5 deletions
|
|
@ -39,6 +39,7 @@ class SendAnimation:
|
|||
unsave: bool = False,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
caption_entities: List["types.MessageEntity"] = None,
|
||||
has_spoiler: bool = None,
|
||||
duration: int = 0,
|
||||
width: int = 0,
|
||||
height: int = 0,
|
||||
|
|
@ -89,6 +90,9 @@ class SendAnimation:
|
|||
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 animation needs to be covered with a spoiler animation.
|
||||
|
||||
duration (``int``, *optional*):
|
||||
Duration of sent animation in seconds.
|
||||
|
||||
|
|
@ -185,6 +189,7 @@ class SendAnimation:
|
|||
mime_type=self.guess_mime_type(animation) or "video/mp4",
|
||||
file=file,
|
||||
thumb=thumb,
|
||||
spoiler=has_spoiler,
|
||||
attributes=[
|
||||
raw.types.DocumentAttributeVideo(
|
||||
supports_streaming=True,
|
||||
|
|
@ -198,7 +203,8 @@ class SendAnimation:
|
|||
)
|
||||
elif re.match("^https?://", animation):
|
||||
media = raw.types.InputMediaDocumentExternal(
|
||||
url=animation
|
||||
url=animation,
|
||||
spoiler=has_spoiler
|
||||
)
|
||||
else:
|
||||
media = utils.get_input_media_from_file_id(animation, FileType.ANIMATION)
|
||||
|
|
@ -209,6 +215,7 @@ class SendAnimation:
|
|||
mime_type=self.guess_mime_type(file_name or animation.name) or "video/mp4",
|
||||
file=file,
|
||||
thumb=thumb,
|
||||
spoiler=has_spoiler,
|
||||
attributes=[
|
||||
raw.types.DocumentAttributeVideo(
|
||||
supports_streaming=True,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class SendPhoto:
|
|||
caption: str = "",
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
caption_entities: List["types.MessageEntity"] = None,
|
||||
has_spoiler: bool = None,
|
||||
ttl_seconds: int = None,
|
||||
disable_notification: bool = None,
|
||||
message_thread_id: int = None,
|
||||
|
|
@ -79,6 +80,9 @@ class SendPhoto:
|
|||
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.
|
||||
|
||||
ttl_seconds (``int``, *optional*):
|
||||
Self-Destruct Timer.
|
||||
If you set a timer, the photo will self-destruct in *ttl_seconds*
|
||||
|
|
@ -154,12 +158,14 @@ class SendPhoto:
|
|||
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
|
||||
media = raw.types.InputMediaUploadedPhoto(
|
||||
file=file,
|
||||
ttl_seconds=ttl_seconds
|
||||
ttl_seconds=ttl_seconds,
|
||||
spoiler=has_spoiler,
|
||||
)
|
||||
elif re.match("^https?://", photo):
|
||||
media = raw.types.InputMediaPhotoExternal(
|
||||
url=photo,
|
||||
ttl_seconds=ttl_seconds
|
||||
ttl_seconds=ttl_seconds,
|
||||
spoiler=has_spoiler
|
||||
)
|
||||
else:
|
||||
media = utils.get_input_media_from_file_id(photo, FileType.PHOTO, ttl_seconds=ttl_seconds)
|
||||
|
|
@ -167,7 +173,8 @@ class SendPhoto:
|
|||
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
|
||||
media = raw.types.InputMediaUploadedPhoto(
|
||||
file=file,
|
||||
ttl_seconds=ttl_seconds
|
||||
ttl_seconds=ttl_seconds,
|
||||
spoiler=has_spoiler
|
||||
)
|
||||
|
||||
while True:
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class SendVideo:
|
|||
caption: str = "",
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
caption_entities: List["types.MessageEntity"] = None,
|
||||
has_spoiler: bool = None,
|
||||
ttl_seconds: int = None,
|
||||
duration: int = 0,
|
||||
width: int = 0,
|
||||
|
|
@ -86,6 +87,9 @@ class SendVideo:
|
|||
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 video needs to be covered with a spoiler animation.
|
||||
|
||||
ttl_seconds (``int``, *optional*):
|
||||
Self-Destruct Timer.
|
||||
If you set a timer, the video will self-destruct in *ttl_seconds*
|
||||
|
|
@ -190,6 +194,7 @@ class SendVideo:
|
|||
mime_type=self.guess_mime_type(video) or "video/mp4",
|
||||
file=file,
|
||||
ttl_seconds=ttl_seconds,
|
||||
spoiler=has_spoiler,
|
||||
thumb=thumb,
|
||||
attributes=[
|
||||
raw.types.DocumentAttributeVideo(
|
||||
|
|
@ -204,7 +209,8 @@ class SendVideo:
|
|||
elif re.match("^https?://", video):
|
||||
media = raw.types.InputMediaDocumentExternal(
|
||||
url=video,
|
||||
ttl_seconds=ttl_seconds
|
||||
ttl_seconds=ttl_seconds,
|
||||
spoiler=has_spoiler
|
||||
)
|
||||
else:
|
||||
media = utils.get_input_media_from_file_id(video, FileType.VIDEO, ttl_seconds=ttl_seconds)
|
||||
|
|
@ -215,6 +221,7 @@ class SendVideo:
|
|||
mime_type=self.guess_mime_type(file_name or video.name) or "video/mp4",
|
||||
file=file,
|
||||
ttl_seconds=ttl_seconds,
|
||||
spoiler=has_spoiler,
|
||||
thumb=thumb,
|
||||
attributes=[
|
||||
raw.types.DocumentAttributeVideo(
|
||||
|
|
|
|||
Loading…
Reference in a new issue