stop()¶
- async Client.stop()¶
Stop the Client.
Usable by Users BotsThis 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 withblock=Falsein case you want to stop the own client within a handler in order not to cause a deadlock. Defaults to True.- Returns:
Client– The stopped client itself.
Stopping a client that is already stopped does nothing. A client that connected but never finished starting up is still disconnected.
Example
from pyrogram import Client app = Client("my_account") async def main(): await app.start() ... # Invoke API methods await app.stop() app.run(main())