set_chat_message_auto_delete_time()#

Client.set_chat_message_auto_delete_time()#

Changes the message auto-delete or self-destruct (for secret chats) time in a chat.

Requires change_info administrator right in basic groups, supergroups and channels.

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

  • message_auto_delete_time (int) – New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren’t deleted automatically.

Returns:

bool – True on success.

Example

# Set message auto delete for a chat to 1 day
app.set_chat_message_auto_delete_time(chat_id, 86400)

# Set message auto delete for a chat to 1 week
app.set_chat_message_auto_delete_time(chat_id, 604800)

# Disable message auto delete for this chat
app.set_chat_message_auto_delete_time(chat_id, 0)