o
    -˜ŽjV  ã                   @   s\   d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlmZ e  e	¡Z
G dd„ dƒZdS )é    N)ÚUnion)Úraw)Útypes)ÚPhoneNumberUnoccupiedc                   @   s4   e Zd Zdddededededdef f
d	d
„ZdS )ÚSignInÚselfzpyrogram.ClientÚphone_numberÚphone_code_hashÚ
phone_codeÚreturnz
types.Userztypes.TermsOfServicec                 Ã   s|   �|  d¡}|  tjjj|||d�¡I dH }t|tjjjƒr"t	dƒ‚| j
 |jj¡I dH  | j
 d¡I dH  tj | |j¡S )a­  Authorize a user in Telegram with a valid confirmation code.

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

        Parameters:
            phone_number (``str``):
                Phone number in international format (includes the country prefix).

            phone_code_hash (``str``):
                Code identifier taken from the result of :meth:`~pyrogram.Client.send_code`.

            phone_code (``str``):
                The valid confirmation code you received (either as Telegram message or as SMS in your phone number).

        Returns:
            :obj:`~pyrogram.types.User` | bool: On success, in case the
            authorization completed, the user is returned.

        Raises:
            BadRequest: In case the arguments are invalid.
            SessionPasswordNeeded: In case a password is needed to sign in.
            PhoneNumberUnoccupied: In case the phone number is not registered on Telegram.
        z +)r   r	   r
   Nz`The phone number is not registered on Telegram. Please use official Telegram app to register it.F)ÚstripÚinvoker   Ú	functionsÚauthr   Ú
isinstancer   ÚAuthorizationSignUpRequiredr   ÚstorageÚuser_idÚuserÚidÚis_botÚUserÚ_parse)r   r   r	   r
   Úr© r   úZ/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/auth/sign_in.pyÚsign_in    s   €
ý
ÿzSignIn.sign_inN)Ú__name__Ú
__module__Ú__qualname__Ústrr   Úboolr   r   r   r   r   r      s    ÿþýüûr   )ÚloggingÚtypingr   Úpyrogramr   r   Úpyrogram.errorsr   Ú	getLoggerr   Úlogr   r   r   r   r   Ú<module>   s   
