mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add view_once parameter to send_photo
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
40b679a878
commit
ed6403db3c
3 changed files with 21 additions and 4 deletions
|
|
@ -51,6 +51,7 @@ class SendPhoto:
|
||||||
schedule_date: datetime = None,
|
schedule_date: datetime = None,
|
||||||
protect_content: bool = None,
|
protect_content: bool = None,
|
||||||
message_effect_id: int = None,
|
message_effect_id: int = None,
|
||||||
|
view_once: bool = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
"types.InlineKeyboardMarkup",
|
"types.InlineKeyboardMarkup",
|
||||||
"types.ReplyKeyboardMarkup",
|
"types.ReplyKeyboardMarkup",
|
||||||
|
|
@ -136,6 +137,10 @@ class SendPhoto:
|
||||||
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.
|
||||||
|
|
||||||
|
view_once (``bool``, *optional*):
|
||||||
|
Self-Destruct Timer.
|
||||||
|
If True, the photo 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.
|
||||||
|
|
@ -201,23 +206,23 @@ class SendPhoto:
|
||||||
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
|
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
|
||||||
media = raw.types.InputMediaUploadedPhoto(
|
media = raw.types.InputMediaUploadedPhoto(
|
||||||
file=file,
|
file=file,
|
||||||
ttl_seconds=ttl_seconds,
|
ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds,
|
||||||
spoiler=has_spoiler,
|
spoiler=has_spoiler,
|
||||||
)
|
)
|
||||||
elif re.match("^https?://", photo):
|
elif re.match("^https?://", photo):
|
||||||
media = raw.types.InputMediaPhotoExternal(
|
media = raw.types.InputMediaPhotoExternal(
|
||||||
url=photo,
|
url=photo,
|
||||||
ttl_seconds=ttl_seconds,
|
ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds,
|
||||||
spoiler=has_spoiler
|
spoiler=has_spoiler
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
media = utils.get_input_media_from_file_id(photo, FileType.PHOTO, ttl_seconds=ttl_seconds)
|
media = utils.get_input_media_from_file_id(photo, FileType.PHOTO, ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds)
|
||||||
media.spoiler = has_spoiler
|
media.spoiler = has_spoiler
|
||||||
else:
|
else:
|
||||||
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
|
file = await self.save_file(photo, progress=progress, progress_args=progress_args)
|
||||||
media = raw.types.InputMediaUploadedPhoto(
|
media = raw.types.InputMediaUploadedPhoto(
|
||||||
file=file,
|
file=file,
|
||||||
ttl_seconds=ttl_seconds,
|
ttl_seconds=(1 << 31) - 1 if view_once else ttl_seconds,
|
||||||
spoiler=has_spoiler
|
spoiler=has_spoiler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2663,6 +2663,7 @@ class Message(Object, Update):
|
||||||
reply_in_chat_id: Union[int, str] = None,
|
reply_in_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,
|
||||||
|
view_once: bool = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
"types.InlineKeyboardMarkup",
|
"types.InlineKeyboardMarkup",
|
||||||
"types.ReplyKeyboardMarkup",
|
"types.ReplyKeyboardMarkup",
|
||||||
|
|
@ -2725,6 +2726,10 @@ class Message(Object, Update):
|
||||||
reply_to_message_id (``int``, *optional*):
|
reply_to_message_id (``int``, *optional*):
|
||||||
If the message is a reply, ID of the original message.
|
If the message is a reply, ID of the original message.
|
||||||
|
|
||||||
|
view_once (``bool``, *optional*):
|
||||||
|
Self-Destruct Timer.
|
||||||
|
If True, the photo will self-destruct after it was viewed.
|
||||||
|
|
||||||
business_connection_id (``str``, *optional*):
|
business_connection_id (``str``, *optional*):
|
||||||
Business connection identifier.
|
Business connection identifier.
|
||||||
for business bots only.
|
for business bots only.
|
||||||
|
|
@ -2809,6 +2814,7 @@ class Message(Object, Update):
|
||||||
reply_to_chat_id=reply_to_chat_id,
|
reply_to_chat_id=reply_to_chat_id,
|
||||||
quote_text=quote_text,
|
quote_text=quote_text,
|
||||||
quote_entities=quote_entities,
|
quote_entities=quote_entities,
|
||||||
|
view_once=view_once,
|
||||||
reply_markup=reply_markup,
|
reply_markup=reply_markup,
|
||||||
progress=progress,
|
progress=progress,
|
||||||
progress_args=progress_args
|
progress_args=progress_args
|
||||||
|
|
|
||||||
|
|
@ -823,6 +823,7 @@ class Story(Object, Update):
|
||||||
caption_entities: List["types.MessageEntity"] = None,
|
caption_entities: List["types.MessageEntity"] = None,
|
||||||
has_spoiler: bool = None,
|
has_spoiler: bool = None,
|
||||||
ttl_seconds: int = None,
|
ttl_seconds: int = None,
|
||||||
|
view_once: bool = None,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_story_id: int = None,
|
reply_to_story_id: int = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
|
|
@ -876,6 +877,10 @@ class Story(Object, Update):
|
||||||
If you set a timer, the photo will self-destruct in *ttl_seconds*
|
If you set a timer, the photo will self-destruct in *ttl_seconds*
|
||||||
seconds after it was viewed.
|
seconds after it was viewed.
|
||||||
|
|
||||||
|
view_once (``bool``, *optional*):
|
||||||
|
Self-Destruct Timer.
|
||||||
|
If True, the photo will self-destruct after it was viewed.
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
Users will receive a notification with no sound.
|
Users will receive a notification with no sound.
|
||||||
|
|
@ -928,6 +933,7 @@ class Story(Object, Update):
|
||||||
caption_entities=caption_entities,
|
caption_entities=caption_entities,
|
||||||
has_spoiler=has_spoiler,
|
has_spoiler=has_spoiler,
|
||||||
ttl_seconds=ttl_seconds,
|
ttl_seconds=ttl_seconds,
|
||||||
|
view_once=view_once,
|
||||||
disable_notification=disable_notification,
|
disable_notification=disable_notification,
|
||||||
reply_to_story_id=reply_to_story_id,
|
reply_to_story_id=reply_to_story_id,
|
||||||
reply_markup=reply_markup,
|
reply_markup=reply_markup,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue