mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Add "unsave" parameter to send_animation
This commit is contained in:
parent
1be8ca94cc
commit
896c9fa4fd
@ -31,6 +31,7 @@ class SendAnimation(BaseClient):
|
|||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
animation: str,
|
animation: str,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
|
unsave: bool = False,
|
||||||
parse_mode: str = "",
|
parse_mode: str = "",
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
width: int = 0,
|
width: int = 0,
|
||||||
@ -64,6 +65,10 @@ class SendAnimation(BaseClient):
|
|||||||
caption (``str``, *optional*):
|
caption (``str``, *optional*):
|
||||||
Animation caption, 0-1024 characters.
|
Animation caption, 0-1024 characters.
|
||||||
|
|
||||||
|
unsave (``bool``, *optional*):
|
||||||
|
By default, the server will save into your own collection any new animation GIF you send.
|
||||||
|
Pass True to automatically unsave the sent animation. Defaults to False.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
URLs in your caption. Defaults to "markdown".
|
URLs in your caption. Defaults to "markdown".
|
||||||
@ -171,10 +176,24 @@ class SendAnimation(BaseClient):
|
|||||||
else:
|
else:
|
||||||
for i in r.updates:
|
for i in r.updates:
|
||||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||||
return pyrogram.Message._parse(
|
message = pyrogram.Message._parse(
|
||||||
self, i.message,
|
self, i.message,
|
||||||
{i.id: i for i in r.users},
|
{i.id: i for i in r.users},
|
||||||
{i.id: i for i in r.chats}
|
{i.id: i for i in r.chats}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if unsave:
|
||||||
|
document = message.animation or message.document
|
||||||
|
document_id = utils.get_input_media_from_file_id(document.file_id).id
|
||||||
|
|
||||||
|
self.send(
|
||||||
|
functions.messages.SaveGif(
|
||||||
|
id=document_id,
|
||||||
|
unsave=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return message
|
||||||
|
|
||||||
except BaseClient.StopTransmission:
|
except BaseClient.StopTransmission:
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user