set_chat_ttl()#

Client.set_chat_ttl()#

Set the time-to-live for the chat.

Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat.

  • ttl_seconds (int) – The time-to-live for the chat. Either 86000 for 1 day, 604800 for 1 week or 0 (zero) to disable it.

Returns:

bool – True on success.

Example

# Set TTL for a chat to 1 day
app.set_chat_ttl(chat_id, 86400)

# Set TTL for a chat to 1 week
app.set_chat_ttl(chat_id, 604800)

# Disable TTL for this chat
app.set_chat_ttl(chat_id, 0)