From 17123664f1dd625004d905c151e303c0a237c80a Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Tue, 23 Jan 2024 23:41:07 +0300 Subject: [PATCH] Add support for self-destructing video notes --- pyrogram/methods/messages/send_video_note.py | 12 +++++++++++- pyrogram/types/messages_and_media/message.py | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py index a9b9aa6f..c95a5b98 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -49,6 +49,7 @@ class SendVideoNote: quote_offset: int = None, schedule_date: datetime = None, protect_content: bool = None, + ttl_seconds: int = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -123,6 +124,11 @@ class SendVideoNote: protect_content (``bool``, *optional*): Protects the contents of the sent message from forwarding and saving. + ttl_seconds (``int``, *optional*): + Self-Destruct Timer. + If you set a timer, the video note will self-destruct in *ttl_seconds* + seconds after it was viewed. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -162,6 +168,9 @@ class SendVideoNote: # Set video note length await app.send_video_note("me", "video_note.mp4", length=25) + + # Send self-destructing video note + await app.send_voice("me", "video_note.mp4", ttl_seconds=(1 << 31) - 1) """ file = None @@ -181,7 +190,8 @@ class SendVideoNote: w=length, h=length ) - ] + ], + ttl_seconds=ttl_seconds ) else: media = utils.get_input_media_from_file_id(video_note, FileType.VIDEO_NOTE) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index b50612bc..a2b7c39a 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -3136,6 +3136,8 @@ class Message(Object, Update): quote_text: str = None, parse_mode: Optional["enums.ParseMode"] = None, quote_entities: List["types.MessageEntity"] = None, + protect_content: bool = None, + ttl_seconds: int = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -3206,6 +3208,14 @@ class Message(Object, Update): quote_entities (List of :obj:`~pyrogram.types.MessageEntity`): List of special entities that appear in quote text, which can be specified instead of *parse_mode*. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + + ttl_seconds (``int``, *optional*): + Self-Destruct Timer. + If you set a timer, the video note will self-destruct in *ttl_seconds* + seconds after it was viewed. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -3261,6 +3271,8 @@ class Message(Object, Update): quote_text=quote_text, parse_mode=parse_mode, quote_entities=quote_entities, + protect_content=protect_content, + ttl_seconds=ttl_seconds, reply_markup=reply_markup, progress=progress, progress_args=progress_args