@@ -31,6 +31,7 @@ def send_animation(
3131 chat_id : Union [int , str ],
3232 animation : str ,
3333 caption : str = "" ,
34+ unsave : bool = False ,
3435 parse_mode : str = "" ,
3536 duration : int = 0 ,
3637 width : int = 0 ,
@@ -64,6 +65,10 @@ def send_animation(
6465 caption (``str``, *optional*):
6566 Animation caption, 0-1024 characters.
6667
68+ unsave (``bool``, *optional*):
69+ By default, the server will save into your own collection any new animation GIF you send.
70+ Pass True to automatically unsave the sent animation. Defaults to False.
71+
6772 parse_mode (``str``, *optional*):
6873 Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
6974 URLs in your caption. Defaults to "markdown".
@@ -171,10 +176,24 @@ def send_animation(
171176 else :
172177 for i in r .updates :
173178 if isinstance (i , (types .UpdateNewMessage , types .UpdateNewChannelMessage )):
174- return pyrogram .Message ._parse (
179+ message = pyrogram .Message ._parse (
175180 self , i .message ,
176181 {i .id : i for i in r .users },
177182 {i .id : i for i in r .chats }
178183 )
184+
185+ if unsave :
186+ document = message .animation or message .document
187+ document_id = utils .get_input_media_from_file_id (document .file_id ).id
188+
189+ self .send (
190+ functions .messages .SaveGif (
191+ id = document_id ,
192+ unsave = True
193+ )
194+ )
195+
196+ return message
197+
179198 except BaseClient .StopTransmission :
180199 return None
0 commit comments