From ff305c92deeb83f0c6d69352c51e0575f63fb90c Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Tue, 23 Jan 2024 23:41:07 +0300 Subject: [PATCH] Pyrofork: Add support for self-destructing video notes Signed-off-by: wulan17 --- pyrofork/methods/messages/send_video_note.py | 12 +++++++++++- pyrofork/types/messages_and_media/message.py | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pyrofork/methods/messages/send_video_note.py b/pyrofork/methods/messages/send_video_note.py index a184dda4..8f5984cb 100644 --- a/pyrofork/methods/messages/send_video_note.py +++ b/pyrofork/methods/messages/send_video_note.py @@ -49,6 +49,7 @@ class SendVideoNote: parse_mode: Optional["enums.ParseMode"] = None, schedule_date: datetime = None, protect_content: bool = None, + ttl_seconds: int = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -126,6 +127,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:`~pyrofork.types.InlineKeyboardMarkup` | :obj:`~pyrofork.types.ReplyKeyboardMarkup` | :obj:`~pyrofork.types.ReplyKeyboardRemove` | :obj:`~pyrofork.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. @@ -165,6 +171,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 @@ -196,7 +205,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/pyrofork/types/messages_and_media/message.py b/pyrofork/types/messages_and_media/message.py index 2f37a8ce..95e9609f 100644 --- a/pyrofork/types/messages_and_media/message.py +++ b/pyrofork/types/messages_and_media/message.py @@ -3288,6 +3288,8 @@ class Message(Object, Update): quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, parse_mode: Optional["enums.ParseMode"] = None, + protect_content: bool = None, + ttl_seconds: int = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -3356,6 +3358,14 @@ class Message(Object, Update): List of special entities that appear in quote_text, which can be specified instead of *parse_mode*. for reply_to_message only. + 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:`~pyrofork.types.InlineKeyboardMarkup` | :obj:`~pyrofork.types.ReplyKeyboardMarkup` | :obj:`~pyrofork.types.ReplyKeyboardRemove` | :obj:`~pyrofork.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. @@ -3418,6 +3428,8 @@ class Message(Object, Update): reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, + protect_content=protect_content, + ttl_seconds=ttl_seconds, parse_mode=parse_mode, reply_markup=reply_markup, progress=progress,