o
    -˜Žj0  ã                   @   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ddeddfdd„ZdS )	Ú	SignInBotÚselfzpyrogram.ClientÚ	bot_tokenÚreturnz
types.Userc              
   Ã   s2  �	 z|   tjjjd| j| j|d�¡I dH }W nd ty{ } zX| 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 Y d}~n!d}~ww | j
 |jj¡I dH  | j
 d¡I dH  tj | |j¡S q)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.
        Tr   )ÚflagsÚapi_idÚapi_hashÚbot_auth_tokenN)Úinvoker   Ú	functionsÚauthÚImportBotAuthorizationr   r   r   ÚsessionÚstopÚstorageÚdc_idÚvalueÚauth_keyr   Ú	test_modeÚcreater   ÚstartÚuser_idÚuserÚidÚis_botr   ÚUserÚ_parse)r   r	   ÚrÚe© r$   ú^/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/auth/sign_in_bot.pyÚsign_in_bot    sB   €üÿþý
ÿþ€ðázSignInBot.sign_in_botN)Ú__name__Ú
__module__Ú__qualname__Ústrr&   r$   r$   r$   r%   r      s    ÿþýr   )ÚloggingÚpyrogramr   r   Úpyrogram.errorsr   Úpyrogram.sessionr   r   Ú	getLoggerr'   Úlogr   r$   r$   r$   r%   Ú<module>   s   
