mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Pyrofork: Add cover and start_timestamp in send_video, reply_video
Signed-off-by: Yasir <git@yasir.id>
This commit is contained in:
parent
7662cc164f
commit
5c1c72f068
4 changed files with 67 additions and 12 deletions
|
|
@ -36,7 +36,9 @@ class ForwardMessages:
|
||||||
schedule_date: datetime = None,
|
schedule_date: datetime = None,
|
||||||
protect_content: bool = None,
|
protect_content: bool = None,
|
||||||
allow_paid_broadcast: bool = None,
|
allow_paid_broadcast: bool = None,
|
||||||
drop_author: bool = None
|
drop_author: bool = None,
|
||||||
|
remove_caption: bool = None,
|
||||||
|
new_video_start_timestamp: int = None,
|
||||||
) -> Union["types.Message", List["types.Message"]]:
|
) -> Union["types.Message", List["types.Message"]]:
|
||||||
"""Forward messages of any kind.
|
"""Forward messages of any kind.
|
||||||
|
|
||||||
|
|
@ -76,7 +78,13 @@ class ForwardMessages:
|
||||||
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only.
|
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only.
|
||||||
|
|
||||||
drop_author (``bool``, *optional*):
|
drop_author (``bool``, *optional*):
|
||||||
Forwards messages without quoting the original author
|
Pass True to forwards messages without quoting the original author.
|
||||||
|
|
||||||
|
remove_caption (``bool``, *optional*):
|
||||||
|
Pass True to remove media captions of message copies.
|
||||||
|
|
||||||
|
new_video_start_timestamp (``int``, *optional*):
|
||||||
|
The new video start timestamp. Pass time to replace video start timestamp in the forwarded message.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
:obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was not
|
:obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was not
|
||||||
|
|
@ -106,7 +114,9 @@ class ForwardMessages:
|
||||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||||
noforwards=protect_content,
|
noforwards=protect_content,
|
||||||
allow_paid_floodskip=allow_paid_broadcast,
|
allow_paid_floodskip=allow_paid_broadcast,
|
||||||
drop_author=drop_author
|
drop_author=drop_author,
|
||||||
|
drop_media_captions=remove_caption,
|
||||||
|
video_timestamp=new_video_start_timestamp
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ class SendVideo:
|
||||||
reply_to_chat_id: Union[int, str] = None,
|
reply_to_chat_id: Union[int, str] = None,
|
||||||
quote_text: str = None,
|
quote_text: str = None,
|
||||||
quote_entities: List["types.MessageEntity"] = None,
|
quote_entities: List["types.MessageEntity"] = None,
|
||||||
|
cover: Optional[Union[str, "io.BytesIO"]] = None,
|
||||||
|
start_timestamp: int = None,
|
||||||
schedule_date: datetime = None,
|
schedule_date: datetime = None,
|
||||||
protect_content: bool = None,
|
protect_content: bool = None,
|
||||||
allow_paid_broadcast: bool = None,
|
allow_paid_broadcast: bool = None,
|
||||||
|
|
@ -159,6 +161,12 @@ class SendVideo:
|
||||||
List of special entities that appear in quote_text, which can be specified instead of *parse_mode*.
|
List of special entities that appear in quote_text, which can be specified instead of *parse_mode*.
|
||||||
for reply_to_message only.
|
for reply_to_message only.
|
||||||
|
|
||||||
|
cover (``str`` | :obj:`io.BytesIO`, *optional*):
|
||||||
|
Cover of the video; pass None to skip cover uploading.
|
||||||
|
|
||||||
|
start_timestamp (``int``, *optional*):
|
||||||
|
Timestamp from which the video playing must start, in seconds.
|
||||||
|
|
||||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||||
Date when the message will be automatically sent.
|
Date when the message will be automatically sent.
|
||||||
|
|
||||||
|
|
@ -255,13 +263,17 @@ class SendVideo:
|
||||||
h=height
|
h=height
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(video))
|
raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(video))
|
||||||
]
|
],
|
||||||
|
video_cover=await self.save_file(cover) if cover else None,
|
||||||
|
video_timestamp=start_timestamp
|
||||||
)
|
)
|
||||||
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=ttl_seconds,
|
||||||
spoiler=has_spoiler
|
spoiler=has_spoiler,
|
||||||
|
video_cover=await self.save_file(cover) if cover else None,
|
||||||
|
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=ttl_seconds)
|
||||||
|
|
@ -283,7 +295,9 @@ class SendVideo:
|
||||||
h=height
|
h=height
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=file_name or video.name)
|
raw.types.DocumentAttributeFilename(file_name=file_name or video.name)
|
||||||
]
|
],
|
||||||
|
video_cover=await self.save_file(cover) if cover else None,
|
||||||
|
video_timestamp=start_timestamp
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,9 @@ class SendPaidMedia:
|
||||||
spoiler=i.has_spoiler,
|
spoiler=i.has_spoiler,
|
||||||
mime_type=self.guess_mime_type(i.media) or "video/mp4",
|
mime_type=self.guess_mime_type(i.media) or "video/mp4",
|
||||||
nosound_video=is_animation,
|
nosound_video=is_animation,
|
||||||
attributes=attributes
|
attributes=attributes,
|
||||||
|
video_cover=await self.save_file(i.cover),
|
||||||
|
video_timestamp=i.start_timestamp
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -219,6 +221,8 @@ class SendPaidMedia:
|
||||||
peer=await self.resolve_peer(chat_id),
|
peer=await self.resolve_peer(chat_id),
|
||||||
media=raw.types.InputMediaDocumentExternal(
|
media=raw.types.InputMediaDocumentExternal(
|
||||||
url=i.media,
|
url=i.media,
|
||||||
|
video_cover=await self.save_file(i.cover),
|
||||||
|
video_timestamp=i.start_timestamp,
|
||||||
spoiler=i.has_spoiler
|
spoiler=i.has_spoiler
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -251,7 +255,9 @@ class SendPaidMedia:
|
||||||
h=i.height
|
h=i.height
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "video.mp4"))
|
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "video.mp4"))
|
||||||
]
|
],
|
||||||
|
video_cover=await self.save_file(i.cover),
|
||||||
|
video_timestamp=i.start_timestamp
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3593,6 +3593,9 @@ 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,
|
||||||
|
cover: Optional[Union[str, "io.BytesIO"]] = None,
|
||||||
|
start_timestamp: int = None,
|
||||||
|
schedule_date: datetime = None,
|
||||||
invert_media: bool = None,
|
invert_media: bool = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
"types.InlineKeyboardMarkup",
|
"types.InlineKeyboardMarkup",
|
||||||
|
|
@ -3695,7 +3698,16 @@ class Message(Object, Update):
|
||||||
for reply_to_message only.
|
for reply_to_message only.
|
||||||
|
|
||||||
allow_paid_broadcast (``bool``, *optional*):
|
allow_paid_broadcast (``bool``, *optional*):
|
||||||
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots
|
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots.
|
||||||
|
|
||||||
|
cover (``str`` | :obj:`io.BytesIO`, *optional*):
|
||||||
|
Cover of the video; pass None to skip cover uploading.
|
||||||
|
|
||||||
|
start_timestamp (``int``, *optional*):
|
||||||
|
Timestamp from which the video playing must start, in seconds.
|
||||||
|
|
||||||
|
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||||
|
Date when the message will be automatically sent.
|
||||||
|
|
||||||
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.
|
||||||
|
|
@ -3779,6 +3791,9 @@ 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,
|
||||||
|
cover=cover,
|
||||||
|
start_timestamp=start_timestamp,
|
||||||
|
schedule_date=schedule_date,
|
||||||
invert_media=invert_media,
|
invert_media=invert_media,
|
||||||
reply_markup=reply_markup,
|
reply_markup=reply_markup,
|
||||||
progress=progress,
|
progress=progress,
|
||||||
|
|
@ -4525,7 +4540,9 @@ class Message(Object, Update):
|
||||||
schedule_date: datetime = None,
|
schedule_date: datetime = None,
|
||||||
protect_content: bool = None,
|
protect_content: bool = None,
|
||||||
allow_paid_broadcast: bool = None,
|
allow_paid_broadcast: bool = None,
|
||||||
drop_author: bool = None
|
drop_author: bool = None,
|
||||||
|
remove_caption: bool = None,
|
||||||
|
new_video_start_timestamp: int = None,
|
||||||
) -> Union["types.Message", List["types.Message"]]:
|
) -> Union["types.Message", List["types.Message"]]:
|
||||||
"""Bound method *forward* of :obj:`~pyrogram.types.Message`.
|
"""Bound method *forward* of :obj:`~pyrogram.types.Message`.
|
||||||
|
|
||||||
|
|
@ -4568,7 +4585,13 @@ class Message(Object, Update):
|
||||||
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots
|
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots
|
||||||
|
|
||||||
drop_author (``bool``, *optional*):
|
drop_author (``bool``, *optional*):
|
||||||
Forwards messages without quoting the original author
|
Forwards messages without quoting the original author.
|
||||||
|
|
||||||
|
remove_caption (``bool``, *optional*):
|
||||||
|
Pass True to remove media captions of message copies.
|
||||||
|
|
||||||
|
new_video_start_timestamp (``int``, *optional*):
|
||||||
|
The new video start timestamp. Pass time to replace video start timestamp in the forwarded message.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the forwarded Message is returned.
|
On success, the forwarded Message is returned.
|
||||||
|
|
@ -4585,7 +4608,9 @@ class Message(Object, Update):
|
||||||
schedule_date=schedule_date,
|
schedule_date=schedule_date,
|
||||||
protect_content=protect_content,
|
protect_content=protect_content,
|
||||||
allow_paid_broadcast=allow_paid_broadcast,
|
allow_paid_broadcast=allow_paid_broadcast,
|
||||||
drop_author=drop_author
|
drop_author=drop_author,
|
||||||
|
remove_caption=remove_caption,
|
||||||
|
new_video_start_timestamp=new_video_start_timestamp,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def copy(
|
async def copy(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue