Ë
    :É„jH  ã                   ó\   — d dl Z d dlmZmZmZ d dlZd dlmZmZmZ d dl	m
Z
  G d„ d«      Zy)é    N)ÚUnionÚBinaryIOÚList)ÚrawÚtypesÚutils)ÚFileTypec                   óz   — e Zd Zddddddœdddeeef   deeef   dedeeee   f   d	eeef   d
edede	f   fd„Z
y)ÚSetChatPhotoN)ÚphotoÚemojiÚemoji_backgroundÚvideoÚvideo_start_tsÚselfzpyrogram.ClientÚchat_idr   r   r   r   r   Úreturnztypes.Messagec             ƒ   óö  K  — | j                  |«      ƒ d{  –—† }|�ót        |t        «      r©t        j                  j                  |«      r:t        j                  j                  | j                  |«      ƒ d{  –—† |¬«      }�nŸt        j                  |t        j                  «      }t        j                  j                  |j                  ¬«      }�nOt        j                  j                  | j                  |«      ƒ d{  –—† |¬«      }�n|�¬t        |t        «      rct        j                  j                  |«      r9t        j                  j                  | j                  |«      ƒ d{  –—† |¬«      }n«t!        d«      ‚t        j                  j                  | j                  |«      ƒ d{  –—† |¬«      }ng|�Z|�|ndg}t        |t"        «      r|g}t        j                  j                  t        j                  j%                  ||¬«      ¬«      }nt!        d	«      ‚t        |t        j                  j&                  «      rM| j)                  t        j*                  j,                  j/                  |j0                  |¬
«      «      ƒ d{  –—† }	nvt        |t        j                  j2                  «      rC| j)                  t        j*                  j4                  j7                  ||¬«      «      ƒ d{  –—† }	nt!        d|› d�«      ‚|	j8                  D ]¼  }
t        |
t        j                  j:                  t        j                  j<                  f«      sŒBt        j>                  jA                  | |
jB                  |	jD                  D �
ci c]  }
|
j                  |
“Œ c}
|	jF                  D �
ci c]  }
|
j                  |
“Œ c}
«      ƒ d{  –—† c S  y7 �ŒÂ7 �Œb7 �ŒÛ7 �Œs7 �Œ27 �ŒW7 Œòc c}
w c c}
w 7 Œ&­w)ar
  Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds).

        The ``photo`` and ``video`` arguments are mutually exclusive.
        Pass either one as named argument (see examples below).

        You must be an administrator in the chat for this to work and must have the appropriate admin rights.

        .. include:: /_includes/usable-by/users-bots.rst

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.
                You can also use chat public link in form of *t.me/<username>* (str).

            photo (``str`` | ``BinaryIO``, *optional*):
                New chat photo. You can pass a :obj:`~pyrogram.types.Photo` file_id, a file path to upload a new photo
                from your local machine or a binary file-like object with its attribute
                ".name" set for in-memory uploads.

            emoji (``int``, *optional*):
                Unique identifier (int) of the emoji to be used as the chat photo.

            emoji_background (``int`` | List of ``int``, *optional*):
                hexadecimal colors or List of hexadecimal colors to be used as the chat photo background.

            video (``str`` | ``BinaryIO``, *optional*):
                New chat video. You can pass a file path to upload a new video
                from your local machine or a binary file-like object with its attribute
                ".name" set for in-memory uploads.

            video_start_ts (``float``, *optional*):
                The timestamp in seconds of the video frame to use as photo profile preview.

        Returns:
            :obj:`~pyrogram.types.Message` | ``bool``: On success, a service message will be returned (when applicable),
            otherwise, in case a message object couldn't be returned, True is returned.

        Raises:
            ValueError: if a chat_id belongs to user.

        Example:
            .. code-block:: python

                # Set chat photo using a local file
                await app.set_chat_photo(chat_id, photo="photo.jpg")

                # Set chat photo using an existing Photo file_id
                await app.set_chat_photo(chat_id, photo=photo.file_id)


                # Set chat photo using an emoji
                await app.set_chat_photo(chat_id, emoji=5366316836101038579)

                # Set chat photo using an emoji and background colors
                await app.set_chat_photo(chat_id, emoji=5366316836101038579, emoji_background=[0xFFFFFF, 0x000000])

                # Set chat video
                await app.set_chat_photo(chat_id, video="video.mp4")
        N)Úfiler   )Úid)r   r   z0You must provide a valid file path for the videoiÿÿÿ )Úemoji_idÚbackground_colors)Úvideo_emoji_markupz4You must provide either a photo, a video or an emoji)r   r   )Úchannelr   zThe chat_id "z" belongs to a userT)$Úresolve_peerÚ
isinstanceÚstrÚosÚpathÚisfiler   r   ÚInputChatUploadedPhotoÚ	save_filer   Úget_input_media_from_file_idr	   ÚPHOTOÚInputChatPhotor   Ú
ValueErrorÚintÚVideoSizeEmojiMarkupÚInputPeerChatÚinvokeÚ	functionsÚmessagesÚEditChatPhotor   ÚInputPeerChannelÚchannelsÚ	EditPhotoÚupdatesÚUpdateNewMessageÚUpdateNewChannelMessageÚMessageÚ_parseÚmessageÚusersÚchats)r   r   r   r   r   r   r   Úpeerr   ÚrÚis              ú\/var/www/html/GAP/venv/lib/python3.12/site-packages/pyrogram/methods/chats/set_chat_photo.pyÚset_chat_photozSetChatPhoto.set_chat_photo   s;  è ø€ ðJ ×&Ñ& wÓ/×/ˆàÐÜ˜%¤Ô%Ü—7‘7—>‘> %Ô(ÜŸI™I×<Ñ<Ø#'§>¡>°%Ó#8×8Ø'5ð =ó ’Eô
 "×>Ñ>¸uÄhÇnÁnÓU�EÜŸI™I×4Ñ4¸¿¹Ð4ÓA’EäŸ	™	×8Ñ8Ø#Ÿ~™~¨eÓ4×4Ø#1ð 9ó ’ð ÐÜ˜%¤Ô%Ü—7‘7—>‘> %Ô(ÜŸI™I×<Ñ<Ø$(§N¡N°5Ó$9×9Ø'5ð =ó ‘Eô
 %Ð%WÓXÐXäŸ	™	×8Ñ8Ø $§¡¨uÓ 5×5Ø#1ð 9ó ‘ð ÐØ4DÐ4PÑ 0ÐW_ÐV`ÐÜÐ+¬SÔ1Ø%6Ð$7Ð!Ü—I‘I×4Ñ4Ü#&§9¡9×#AÑ#AØ"Ø&7ð $Bó $ð 5ó ‰Eô ÐSÓTÐTä�dœCŸI™I×3Ñ3Ô4Ø—k‘kÜ—‘×&Ñ&×4Ñ4Ø ŸL™LØð 5ó ó÷ ‰Aô ˜œcŸi™i×8Ñ8Ô9Ø—k‘kÜ—‘×&Ñ&×0Ñ0Ø Øð 1ó ó÷ ‰Aô ˜}¨W¨IÐ5HÐIÓJÐJà—‘ò 	ˆAÜ˜!œcŸi™i×8Ñ8¼#¿)¹)×:[Ñ:[Ð\Õ]Ü"Ÿ]™]×1Ñ1ØØ—I‘IØ&'§g¡gÖ. �Q—T‘T˜1‘WÒ.Ø&'§g¡gÖ. �Q—T‘T˜1‘WÒ.ó	÷ ò ð	ð ðK 0ùð 9ùð 5ùð :ùð 6ùð"ùðúò /ùÚ.ð	ús²   ‚O9—O˜A"O9Á:OÁ;B	O9ÄOÄA*O9Å/O"Å0AO9Æ3O%Æ4CO9ÊO(ÊA&O9Ë8O+Ë9A!O9Í3O9ÎO-Î"O9Î2O2Ï
O9ÏO7Ï	O9ÏO9ÏO9Ï"O9Ï%O9Ï(O9Ï+O9Ï-O9)Ú__name__Ú
__module__Ú__qualname__r   r'   r   r   r   ÚfloatÚboolr=   © ó    r<   r   r      sž   „ ð
 '+ØØ26Ø&*Ø $òJØðJà�s˜C�x‘ðJð �S˜(�]Ñ#ð	Jð
 ðJð    T¨#¡Y Ñ/ðJð �S˜(�]Ñ#ðJð ðJð 
ˆ Ð$Ñ	%ôJrD   r   )r   Útypingr   r   r   Úpyrogramr   r   r   Úpyrogram.file_idr	   r   rC   rD   r<   ú<module>rH      s(   ðó( 
ß (Ñ (ã ß &Ñ &Ý %÷Kò KrD   