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,
schedule_date: datetime = None,
protect_content: bool = None,
ttl_seconds: int = None,
view_once: bool = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
@ -124,10 +124,9 @@ class SendVideoNote:
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
ttl_seconds (``int``, *optional*):
view_once (``bool``, *optional*):
Self-Destruct Timer.
If you set a timer, the video note will self-destruct in *ttl_seconds*
seconds after it was viewed.
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*):
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)
# 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
@ -191,7 +190,7 @@ class SendVideoNote:
h=length
)
],
ttl_seconds=ttl_seconds
ttl_seconds=(1 << 31) - 1 if view_once else None
)
else:
media = utils.get_input_media_from_file_id(video_note, FileType.VIDEO_NOTE)
@ -209,7 +208,8 @@ class SendVideoNote:
w=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()

View File

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

View File

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

View File

@ -1181,6 +1181,7 @@ class Story(Object, Update):
length: int = 1,
thumb: Union[str, BinaryIO] = None,
disable_notification: bool = None,
view_once: bool = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
@ -1230,6 +1231,10 @@ class Story(Object, Update):
Sends the message silently.
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*):
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.
@ -1272,6 +1277,7 @@ class Story(Object, Update):
thumb=thumb,
disable_notification=disable_notification,
reply_to_story_id=self.id,
view_once=view_once,
reply_markup=reply_markup,
progress=progress,
progress_args=progress_args
@ -1285,6 +1291,7 @@ class Story(Object, Update):
caption_entities: List["types.MessageEntity"] = None,
duration: int = 0,
disable_notification: bool = None,
view_once: bool = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup",
@ -1335,6 +1342,10 @@ class Story(Object, Update):
Sends the message silently.
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*):
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.
@ -1378,6 +1389,7 @@ class Story(Object, Update):
duration=duration,
disable_notification=disable_notification,
reply_to_story_id=self.id,
view_once=view_once,
reply_markup=reply_markup,
progress=progress,
progress_args=progress_args