leave_chat()

Client.leave_chat()

Leave a group chat or channel.

Parameters
  • chat_id (int | str) – Unique identifier for the target chat or username of the target channel/supergroup (in the format @username).

  • delete (bool, optional) – Deletes the group chat dialog after leaving (for simple group chats, not supergroups). Defaults to False.

Example

# Leave chat or channel
app.leave_chat(chat_id)

# Leave basic chat and also delete the dialog
app.leave_chat(chat_id, delete=True)