Ë
    žDjù  ã                   ó\   — d dl Z d dlmZmZ d dlZd dlmZ d dlmZ d dlmZ  G d„ d«      Z	y)é    N)ÚUnionÚBinaryIO)Úraw)Úutils)ÚFileTypec                   óT   — e Zd Zddddœdddeeef   deeef   deeef   ded	efd
„Z	y)ÚSetChatPhotoN)ÚphotoÚvideoÚvideo_start_tsÚselfzpyrogram.ClientÚchat_idr
   r   r   Úreturnc             ƒ   ól  K  — | j                  |«      ƒ d{  –—† }t        |t        «      r¿t        j                  j                  |«      rQt        j                  j                  | j                  |«      ƒ d{  –—† | j                  |«      ƒ d{  –—† |¬«      }nŸt        j                  |t        j                  «      }t        j                  j                  |j                  ¬«      }nPt        j                  j                  | j                  |«      ƒ d{  –—† | j                  |«      ƒ d{  –—† |¬«      }t        |t        j                  j                   «      rM| j#                  t        j$                  j&                  j)                  |j*                  |¬«      «      ƒ d{  –—†  yt        |t        j                  j,                  «      rC| j#                  t        j$                  j.                  j1                  ||¬«      «      ƒ d{  –—†  yt3        d|› d�«      ‚7 �Œ7 �Œ­7 �Œ˜7 �Œ7 Œý7 Œ‰7 Œ$­w)	aÏ  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.

            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.

            video (``str`` | ``BinaryIO``, *optional*):
                New chat video. You can pass a :obj:`~pyrogram.types.Video` file_id, 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:
            ``bool``: True on success.

        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 video using a local file
                await app.set_chat_photo(chat_id, video="video.mp4")

                # Set chat photo using an existing Video file_id
                await app.set_chat_photo(chat_id, video=video.file_id)
        N)Úfiler   r   )Úid)r   r
   )Úchannelr
   zThe chat_id "z" belongs to a userT)Úresolve_peerÚ
isinstanceÚstrÚosÚpathÚisfiler   ÚtypesÚInputChatUploadedPhotoÚ	save_filer   Úget_input_media_from_file_idr   ÚPHOTOÚInputChatPhotor   ÚInputPeerChatÚinvokeÚ	functionsÚmessagesÚEditChatPhotor   ÚInputPeerChannelÚchannelsÚ	EditPhotoÚ
ValueError)r   r   r
   r   r   Úpeers         úU/root/auto/venv/lib/python3.12/site-packages/pyrogram/methods/chats/set_chat_photo.pyÚset_chat_photozSetChatPhoto.set_chat_photo   sÆ  è ø€ ðp ×&Ñ& wÓ/×/ˆä�eœSÔ!Ü�w‰w�~‰~˜eÔ$ÜŸ	™	×8Ñ8Ø#Ÿ~™~¨eÓ4×4Ø $§¡¨uÓ 5×5Ø#1ð 9ó ‘ô ×:Ñ:¸5Ä(Ç.Á.ÓQ�ÜŸ	™	×0Ñ0°E·H±HÐ0Ó=‘ä—I‘I×4Ñ4ØŸ>™>¨%Ó0×0Ø ŸN™N¨5Ó1×1Ø-ð 5ó ˆEô �dœCŸI™I×3Ñ3Ô4Ø—+‘+Ü—‘×&Ñ&×4Ñ4Ø ŸL™LØð 5ó ó÷ ð ð  ô ˜œcŸi™i×8Ñ8Ô9Ø—+‘+Ü—‘×&Ñ&×0Ñ0Ø Øð 1ó ó÷ ð ð ô ˜}¨W¨IÐ5HÐIÓJÐJðE 0ùð
 5ùØ5ùð 1ùØ1øð
øðús   ‚H4—H"˜A H4Á8H%Á9H4ÂH(
ÂBH4ÄH+ÄH4Ä0H.
Ä1A5H4Æ&H0Æ'A&H4ÈH2ÈH4È%H4È(H4È+H4È.H4È0H4È2H4)
Ú__name__Ú
__module__Ú__qualname__r   Úintr   r   ÚfloatÚboolr+   © ó    r*   r	   r	      sk   „ ð
 '+Ø&*Ø $ò\Øð\à�s˜C�x‘ð\ð �S˜(�]Ñ#ð	\ð
 �S˜(�]Ñ#ð\ð ð\ð 
ô\r3   r	   )
r   Útypingr   r   Úpyrogramr   r   Úpyrogram.file_idr   r	   r2   r3   r*   ú<module>r7      s%   ðó& 
ß "ã Ý Ý Ý %÷]ò ]r3   