SetHistoryTTLRequest

Only users can use this request. See code examples.

---functions---
messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates

Returns

Updates

This type can be an instance of either:

UpdateShortUpdateShortChatMessage
UpdateShortMessageUpdateShortSentMessage
UpdatesUpdatesCombined
UpdatesTooLong

Parameters

peerInputPeerAnything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.).
periodint

Known RPC errors

This request can cause 2 known errors:

ChatNotModifiedErrorThe chat or channel wasn't modified (title, invites, username, admins, etc. are the same).
TtlPeriodInvalidErrorThe provided TTL Period is invalid.

You can import these from telethon.errors.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.SetHistoryTTLRequest(
        peer='username',
        period=42
    ))
    print(result.stringify())