U
    ;g
                     @   s`   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZmZ e 	e
ZG dd dZdS )    N)raw)types)UserMigrate)SessionAuthc                   @   s   e Zd ZdeddddZdS )	SignInBotzpyrogram.Clientz
types.User)self	bot_tokenreturnc              
      s0  z*|  tjjjd| j| j|dI dH }W n tk
r } z| j	 I dH  | j
|jI dH  | j
t| | j
 I dH | j
 I dH  I dH I dH  t| | j
 I dH | j
 I dH | j
 I dH | _| j I dH  W 5 d}~X Y q X | j
|jjI dH  | j
dI dH  tj| |jS q dS )a  Authorize a bot using its bot token generated by BotFather.

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

        Parameters:
            bot_token (``str``):
                The bot token generated by BotFather

        Returns:
            :obj:`~pyrogram.types.User`: On success, the bot identity is return in form of a user object.

        Raises:
            BadRequest: In case the bot token is invalid.
        r   )flagsapi_idapi_hashZbot_auth_tokenNT)Zinvoker   Z	functionsauthZImportBotAuthorizationr   r   r   sessionstopZstorageZdc_idvalueZauth_keyr   Z	test_modecreater   startZuser_iduseridZis_botr   ZUser_parse)r   r	   re r   a/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/auth/sign_in_bot.pysign_in_bot   s:     
  "zSignInBot.sign_in_botN)__name__
__module____qualname__strr   r   r   r   r   r      s   r   )loggingZpyrogramr   r   Zpyrogram.errorsr   Zpyrogram.sessionr   r   	getLoggerr   logr   r   r   r   r   <module>   s   
