@@ -27,7 +27,8 @@ class SetChatPhoto(BaseClient):
2727 def set_chat_photo (
2828 self ,
2929 chat_id : Union [int , str ],
30- photo : str
30+ photo : str ,
31+ file_ref : str = None
3132 ) -> bool :
3233 """Set a new profile photo for the chat.
3334
@@ -40,6 +41,10 @@ def set_chat_photo(
4041 photo (``str``):
4142 New chat photo. You can pass a :obj:`Photo` file_id or a file path to upload a new photo from your local
4243 machine.
44+
45+ file_ref (``str``, *optional*):
46+ A valid file reference obtained by a recently fetched media message.
47+ To be used in combination with a file id in case a file reference is needed.
4348
4449 Returns:
4550 ``bool``: True on success.
@@ -54,14 +59,14 @@ def set_chat_photo(
5459 app.set_chat_photo(chat_id, "photo.jpg")
5560
5661 # Set chat photo using an exiting Photo file_id
57- app.set_chat_photo(chat_id, photo.file_id)
62+ app.set_chat_photo(chat_id, photo.file_id, photo.file_ref )
5863 """
5964 peer = self .resolve_peer (chat_id )
6065
6166 if os .path .exists (photo ):
6267 photo = types .InputChatUploadedPhoto (file = self .save_file (photo ))
6368 else :
64- photo = utils .get_input_media_from_file_id (photo )
69+ photo = utils .get_input_media_from_file_id (photo , file_ref , 2 )
6570 photo = types .InputChatPhoto (id = photo .id )
6671
6772 if isinstance (peer , types .InputPeerChat ):
0 commit comments