o
    -˜Žj  ã                   @   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„ZdS )Ú	TerminateÚselfúpyrogram.Clientc                 Ã   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  q3| j ¡  | j ¡  | jdurR| 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)Úis_initializedÚConnectionErrorÚ
takeout_idÚinvoker   Ú	functionsÚaccountÚFinishTakeoutSessionÚlogÚinfoÚstorageÚsaveÚ
dispatcherÚstopÚmedia_sessionsÚvaluesÚclearÚupdates_watchdog_eventÚsetÚupdates_watchdog_task)r   Úmedia_session© r   ú\/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/auth/terminate.pyÚ	terminate   s    €




zTerminate.terminateN)r   r   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s    ÿr   )ÚloggingÚpyrogramr   Ú	getLoggerr   r   r   r   r   r   r   Ú<module>   s
   
