mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add view_once parameter to send_video and Message.reply_video
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
beb5b5138b
commit
e2e4f13946
2 changed files with 14 additions and 4 deletions
|
|
@ -58,6 +58,7 @@ class SendVideo:
|
||||||
protect_content: bool = None,
|
protect_content: bool = None,
|
||||||
allow_paid_broadcast: bool = None,
|
allow_paid_broadcast: bool = None,
|
||||||
message_effect_id: int = None,
|
message_effect_id: int = None,
|
||||||
|
view_once: bool = None,
|
||||||
invert_media: bool = None,
|
invert_media: bool = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
"types.InlineKeyboardMarkup",
|
"types.InlineKeyboardMarkup",
|
||||||
|
|
@ -180,6 +181,10 @@ class SendVideo:
|
||||||
message_effect_id (``int`` ``64-bit``, *optional*):
|
message_effect_id (``int`` ``64-bit``, *optional*):
|
||||||
Unique identifier of the message effect to be added to the message; for private chats only.
|
Unique identifier of the message effect to be added to the message; for private chats only.
|
||||||
|
|
||||||
|
view_once (``bool``, *optional*):
|
||||||
|
Self-Destruct Timer.
|
||||||
|
If True, the photo will self-destruct after it was viewed.
|
||||||
|
|
||||||
invert_media (``bool``, *optional*):
|
invert_media (``bool``, *optional*):
|
||||||
Inverts the position of the video and caption.
|
Inverts the position of the video and caption.
|
||||||
|
|
||||||
|
|
@ -298,7 +303,7 @@ class SendVideo:
|
||||||
media = raw.types.InputMediaUploadedDocument(
|
media = raw.types.InputMediaUploadedDocument(
|
||||||
mime_type=self.guess_mime_type(video) or "video/mp4",
|
mime_type=self.guess_mime_type(video) or "video/mp4",
|
||||||
file=file,
|
file=file,
|
||||||
ttl_seconds=ttl_seconds,
|
ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds,
|
||||||
spoiler=has_spoiler,
|
spoiler=has_spoiler,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
|
|
@ -316,13 +321,13 @@ class SendVideo:
|
||||||
elif re.match("^https?://", video):
|
elif re.match("^https?://", video):
|
||||||
media = raw.types.InputMediaDocumentExternal(
|
media = raw.types.InputMediaDocumentExternal(
|
||||||
url=video,
|
url=video,
|
||||||
ttl_seconds=ttl_seconds,
|
ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds,
|
||||||
spoiler=has_spoiler,
|
spoiler=has_spoiler,
|
||||||
video_cover=vidcover_file,
|
video_cover=vidcover_file,
|
||||||
video_timestamp=start_timestamp
|
video_timestamp=start_timestamp
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
media = utils.get_input_media_from_file_id(video, FileType.VIDEO, ttl_seconds=ttl_seconds)
|
media = utils.get_input_media_from_file_id(video, FileType.VIDEO, ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds)
|
||||||
media.spoiler = has_spoiler
|
media.spoiler = has_spoiler
|
||||||
else:
|
else:
|
||||||
thumb = await self.save_file(thumb)
|
thumb = await self.save_file(thumb)
|
||||||
|
|
@ -330,7 +335,7 @@ class SendVideo:
|
||||||
media = raw.types.InputMediaUploadedDocument(
|
media = raw.types.InputMediaUploadedDocument(
|
||||||
mime_type=self.guess_mime_type(file_name or video.name) or "video/mp4",
|
mime_type=self.guess_mime_type(file_name or video.name) or "video/mp4",
|
||||||
file=file,
|
file=file,
|
||||||
ttl_seconds=ttl_seconds,
|
ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds,
|
||||||
spoiler=has_spoiler,
|
spoiler=has_spoiler,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
|
|
|
||||||
|
|
@ -3611,6 +3611,7 @@ class Message(Object, Update):
|
||||||
quote_entities: List["types.MessageEntity"] = None,
|
quote_entities: List["types.MessageEntity"] = None,
|
||||||
allow_paid_broadcast: bool = None,
|
allow_paid_broadcast: bool = None,
|
||||||
message_effect_id: int = None,
|
message_effect_id: int = None,
|
||||||
|
view_once: bool = None,
|
||||||
cover: Union[str, BinaryIO] = None,
|
cover: Union[str, BinaryIO] = None,
|
||||||
start_timestamp: int = None,
|
start_timestamp: int = None,
|
||||||
schedule_date: datetime = None,
|
schedule_date: datetime = None,
|
||||||
|
|
@ -3734,6 +3735,9 @@ class Message(Object, Update):
|
||||||
message_effect_id (``int`` ``64-bit``, *optional*):
|
message_effect_id (``int`` ``64-bit``, *optional*):
|
||||||
Unique identifier of the message effect to be added to the message; for private chats only.
|
Unique identifier of the message effect to be added to the message; for private chats only.
|
||||||
|
|
||||||
|
view_once (``bool``, *optional*):
|
||||||
|
Pass True to send the video as a view-once message.
|
||||||
|
|
||||||
invert_media (``bool``, *optional*):
|
invert_media (``bool``, *optional*):
|
||||||
Pass True to invert the video and caption position.
|
Pass True to invert the video and caption position.
|
||||||
|
|
||||||
|
|
@ -3813,6 +3817,7 @@ class Message(Object, Update):
|
||||||
quote_entities=quote_entities,
|
quote_entities=quote_entities,
|
||||||
allow_paid_broadcast=allow_paid_broadcast,
|
allow_paid_broadcast=allow_paid_broadcast,
|
||||||
message_effect_id=message_effect_id,
|
message_effect_id=message_effect_id,
|
||||||
|
view_once=view_once,
|
||||||
cover=cover,
|
cover=cover,
|
||||||
start_timestamp=start_timestamp,
|
start_timestamp=start_timestamp,
|
||||||
schedule_date=schedule_date,
|
schedule_date=schedule_date,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue