2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Add "unsave" parameter to send_animation

This commit is contained in:
Dan 2019-06-04 16:32:42 +02:00
parent 1be8ca94cc
commit 896c9fa4fd

View File

@ -31,6 +31,7 @@ class SendAnimation(BaseClient):
chat_id: Union[int, str],
animation: str,
caption: str = "",
unsave: bool = False,
parse_mode: str = "",
duration: int = 0,
width: int = 0,
@ -64,6 +65,10 @@ class SendAnimation(BaseClient):
caption (``str``, *optional*):
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*):
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".
@ -171,10 +176,24 @@ class SendAnimation(BaseClient):
else:
for i in r.updates:
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
return pyrogram.Message._parse(
message = pyrogram.Message._parse(
self, i.message,
{i.id: i for i in r.users},
{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:
return None