U
    ç;ãgE  ã                   @   s   d dl Z G dd„ dƒZdS )é    Nc                   @   s   e Zd Zddedœdd„ZdS )ÚStopTzpyrogram.Client)ÚselfÚblockc                 ƒ   s0   ‡ fdd„}|r|ƒ I dH  nˆ j  |ƒ ¡ ˆ S )a°  Stop the Client.

        This method disconnects the client from Telegram and stops the underlying tasks.

        Parameters:
            block (``bool``, *optional*):
                Blocks the code execution until the client has been stopped. It is useful with ``block=False`` in case
                you want to stop the own client *within* a handler in order not to cause a deadlock.
                Defaults to True.

        Returns:
            :obj:`~pyrogram.Client`: The stopped client itself.

        Raises:
            ConnectionError: In case you try to stop an already stopped client.

        Example:
            .. code-block:: python

                from pyrogram import Client

                app = Client("my_account")


                async def main():
                    await app.start()
                    ...  # Invoke API methods
                    await app.stop()


                app.run(main())
        c                   “   s    ˆ   ¡ I d H  ˆ  ¡ I d H  d S )N)Ú	terminateZ
disconnect© ©r   r   ú_/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/utilities/stop.pyÚdo_it<   s    zStop.stop.<locals>.do_itN)ÚloopZcreate_task)r   r   r	   r   r   r   Ústop   s
    %z	Stop.stopN)T)Ú__name__Ú
__module__Ú__qualname__Úboolr   r   r   r   r   r      s
    þþr   )Zpyrogramr   r   r   r   r   Ú<module>   s   