U
    ç;ãgú  ã                   @   s8   d dl Z d dlZd dlmZ e  e¡ZG dd„ dƒZdS )é    N)Úrawc                   @   s   e Zd Zddœdd„ZdS )Ú	Terminatezpyrogram.Client)Úselfc                 Ã   s¶   | j stdƒ‚| jr:|  tjj ¡ ¡I dH  t 	d| j¡ | j
 ¡ I dH  | j ¡ I dH  | j ¡ D ]}| ¡ I dH  qd| j ¡  | j ¡  | jdk	r¢| jI dH  | j ¡  d| _ dS )aF  Terminate the client by shutting down workers.

        This method does the opposite of :meth:`~pyrogram.Client.initialize`.
        It will stop the dispatcher and shut down updates and download workers.

        Raises:
            ConnectionError: In case you try to terminate a client that is already terminated.
        zClient is already terminatedNzTakeout session %s finishedF)Zis_initializedÚConnectionErrorZ
takeout_idZinvoker   Z	functionsÚaccountZFinishTakeoutSessionÚlogÚinfoZstorageÚsaveÚ
dispatcherÚstopZmedia_sessionsÚvaluesÚclearZupdates_watchdog_eventÚsetZupdates_watchdog_task)r   Zmedia_session© r   ú_/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/auth/terminate.pyÚ	terminate   s    



zTerminate.terminateN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s   ÿr   )ÚloggingZpyrogramr   Ú	getLoggerr   r   r   r   r   r   r   Ú<module>   s   
