U
    ;g                     @   sP   d dl Z d dlmZ d dlZd dlmZ d dlmZ e eZG dd dZ	dS )    N)Union)raw)typesc                   @   s,   e Zd Zdeeeeddef dddZdS )SignInzpyrogram.Clientz
types.Userztypes.TermsOfService)selfphone_numberphone_code_hash
phone_codereturnc                    s   | d}| tjjj|||dI dH }t|tjjjrT|j	rPtj
j|j	dS dS | j|jjI dH  | jdI dH  tj| |jS d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` | :obj:`~pyrogram.types.TermsOfService` | bool: On success, in case the
            authorization completed, the user is returned. In case the phone number needs to be registered first AND the
            terms of services accepted (with :meth:`~pyrogram.Client.accept_terms_of_service`), an object containing
            them is returned. In case the phone number needs to be registered, but the terms of services don't need to
            be accepted, False is returned instead.

        Raises:
            BadRequest: In case the arguments are invalid.
            SessionPasswordNeeded: In case a password is needed to sign in.
        z +)r   r   r	   N)terms_of_serviceF)stripZinvoker   Z	functionsauthr   
isinstancer   ZAuthorizationSignUpRequiredr   ZTermsOfService_parseZstorageZuser_iduseridZis_botZUser)r   r   r   r	   r r   ]/opt/bot/vods_filmes/script/venv/lib/python3.8/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   Zpyrogramr   r   	getLoggerr   logr   r   r   r   r   <module>   s   
