Renamed ttl_seconds to view_once in send_video_note and send_voice

This commit is contained in:
KurimuzonAkuma 2024-03-24 21:14:52 +03:00
parent 3b13c0b4c5
commit 50dbfd33fe
4 changed files with 32 additions and 23 deletions

View File

@ -49,7 +49,7 @@ class SendVideoNote:
quote_offset: int = None, quote_offset: int = None,
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
ttl_seconds: int = None, view_once: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -124,10 +124,9 @@ class SendVideoNote:
protect_content (``bool``, *optional*): protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving. Protects the contents of the sent message from forwarding and saving.
ttl_seconds (``int``, *optional*): view_once (``bool``, *optional*):
Self-Destruct Timer. Self-Destruct Timer.
If you set a timer, the video note will self-destruct in *ttl_seconds* If True, the video note will self-destruct after it was viewed.
seconds after it was viewed.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): 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, Additional interface options. An object for an inline keyboard, custom reply keyboard,
@ -170,7 +169,7 @@ class SendVideoNote:
await app.send_video_note("me", "video_note.mp4", length=25) await app.send_video_note("me", "video_note.mp4", length=25)
# Send self-destructing video note # Send self-destructing video note
await app.send_voice("me", "video_note.mp4", ttl_seconds=(1 << 31) - 1) await app.send_video_note("me", "video_note.mp4", view_once=True)
""" """
file = None file = None
@ -191,7 +190,7 @@ class SendVideoNote:
h=length h=length
) )
], ],
ttl_seconds=ttl_seconds ttl_seconds=(1 << 31) - 1 if view_once else None
) )
else: else:
media = utils.get_input_media_from_file_id(video_note, FileType.VIDEO_NOTE) media = utils.get_input_media_from_file_id(video_note, FileType.VIDEO_NOTE)
@ -209,7 +208,8 @@ class SendVideoNote:
w=length, w=length,
h=length h=length
) )
] ],
ttl_seconds=(1 << 31) - 1 if view_once else None
) )
quote_text, quote_entities = (await utils.parse_text_entities(self, quote_text, parse_mode, quote_entities)).values() quote_text, quote_entities = (await utils.parse_text_entities(self, quote_text, parse_mode, quote_entities)).values()

View File

@ -49,7 +49,7 @@ class SendVoice:
quote_offset: int = None, quote_offset: int = None,
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
ttl_seconds: int = None, view_once: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -121,10 +121,9 @@ class SendVoice:
protect_content (``bool``, *optional*): protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving. Protects the contents of the sent message from forwarding and saving.
ttl_seconds (``int``, *optional*): view_once (``bool``, *optional*):
Self-Destruct Timer. Self-Destruct Timer.
If you set a timer, the voice note will self-destruct in *ttl_seconds* If True, the voice note will self-destruct after it was listened.
seconds after it was listened.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): 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, Additional interface options. An object for an inline keyboard, custom reply keyboard,
@ -189,7 +188,7 @@ class SendVoice:
duration=duration duration=duration
) )
], ],
ttl_seconds=ttl_seconds ttl_seconds=(1 << 31) - 1 if view_once else None
) )
elif re.match("^https?://", voice): elif re.match("^https?://", voice):
media = raw.types.InputMediaDocumentExternal( media = raw.types.InputMediaDocumentExternal(
@ -211,7 +210,7 @@ class SendVoice:
duration=duration duration=duration
) )
], ],
ttl_seconds=ttl_seconds ttl_seconds=(1 << 31) - 1 if view_once else None
) )
quote_text, quote_entities = (await utils.parse_text_entities(self, quote_text, parse_mode, quote_entities)).values() quote_text, quote_entities = (await utils.parse_text_entities(self, quote_text, parse_mode, quote_entities)).values()

View File

@ -3164,7 +3164,7 @@ class Message(Object, Update):
parse_mode: Optional["enums.ParseMode"] = None, parse_mode: Optional["enums.ParseMode"] = None,
quote_entities: List["types.MessageEntity"] = None, quote_entities: List["types.MessageEntity"] = None,
protect_content: bool = None, protect_content: bool = None,
ttl_seconds: int = None, view_once: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -3238,10 +3238,9 @@ class Message(Object, Update):
protect_content (``bool``, *optional*): protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving. Protects the contents of the sent message from forwarding and saving.
ttl_seconds (``int``, *optional*): view_once (``bool``, *optional*):
Self-Destruct Timer. Self-Destruct Timer.
If you set a timer, the video note will self-destruct in *ttl_seconds* If True, the video note will self-destruct after it was viewed.
seconds after it was viewed.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): 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, Additional interface options. An object for an inline keyboard, custom reply keyboard,
@ -3299,7 +3298,7 @@ class Message(Object, Update):
parse_mode=parse_mode, parse_mode=parse_mode,
quote_entities=quote_entities, quote_entities=quote_entities,
protect_content=protect_content, protect_content=protect_content,
ttl_seconds=ttl_seconds, view_once=view_once,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
progress_args=progress_args progress_args=progress_args
@ -3318,7 +3317,7 @@ class Message(Object, Update):
reply_to_message_id: int = None, reply_to_message_id: int = None,
quote_text: str = None, quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None, quote_entities: List["types.MessageEntity"] = None,
ttl_seconds: int = None, view_once: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -3386,10 +3385,9 @@ class Message(Object, Update):
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`): 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*. List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
ttl_seconds (``int``, *optional*): view_once (``bool``, *optional*):
Self-Destruct Timer. Self-Destruct Timer.
If you set a timer, the voice note will self-destruct in *ttl_seconds* If True, the voice note will self-destruct after it was listened.
seconds after it was listened.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): 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, Additional interface options. An object for an inline keyboard, custom reply keyboard,
@ -3446,7 +3444,7 @@ class Message(Object, Update):
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
quote_text=quote_text, quote_text=quote_text,
quote_entities=quote_entities, quote_entities=quote_entities,
ttl_seconds=ttl_seconds, view_once=view_once,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
progress_args=progress_args progress_args=progress_args

View File

@ -1181,6 +1181,7 @@ class Story(Object, Update):
length: int = 1, length: int = 1,
thumb: Union[str, BinaryIO] = None, thumb: Union[str, BinaryIO] = None,
disable_notification: bool = None, disable_notification: bool = None,
view_once: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -1230,6 +1231,10 @@ class Story(Object, Update):
Sends the message silently. Sends the message silently.
Users will receive a notification with no sound. Users will receive a notification with no sound.
view_once (``bool``, *optional*):
Self-Destruct Timer.
If True, the video note will self-destruct after it was viewed.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): 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, 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. instructions to remove reply keyboard or to force a reply from the user.
@ -1272,6 +1277,7 @@ class Story(Object, Update):
thumb=thumb, thumb=thumb,
disable_notification=disable_notification, disable_notification=disable_notification,
reply_to_story_id=self.id, reply_to_story_id=self.id,
view_once=view_once,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
progress_args=progress_args progress_args=progress_args
@ -1285,6 +1291,7 @@ class Story(Object, Update):
caption_entities: List["types.MessageEntity"] = None, caption_entities: List["types.MessageEntity"] = None,
duration: int = 0, duration: int = 0,
disable_notification: bool = None, disable_notification: bool = None,
view_once: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -1335,6 +1342,10 @@ class Story(Object, Update):
Sends the message silently. Sends the message silently.
Users will receive a notification with no sound. Users will receive a notification with no sound.
view_once (``bool``, *optional*):
Self-Destruct Timer.
If True, the voice note will self-destruct after it was listened.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): 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, 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. instructions to remove reply keyboard or to force a reply from the user.
@ -1378,6 +1389,7 @@ class Story(Object, Update):
duration=duration, duration=duration,
disable_notification=disable_notification, disable_notification=disable_notification,
reply_to_story_id=self.id, reply_to_story_id=self.id,
view_once=view_once,
reply_markup=reply_markup, reply_markup=reply_markup,
progress=progress, progress=progress,
progress_args=progress_args progress_args=progress_args