SetPrivacyRequest

Only users can use this request. See code examples.

---functions---
account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector<InputPrivacyRule> = account.PrivacyRules

Returns

account.PrivacyRules

This type can only be an instance of:

PrivacyRules

Parameters

keyInputPrivacyKey
rulesInputPrivacyRuleA list must be supplied.

Known RPC errors

This request can cause 2 known errors:

PrivacyKeyInvalidErrorThe privacy key is invalid.
PrivacyTooLongErrorCannot add that many entities in a single request.

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.account.SetPrivacyRequest(
        key=types.InputPrivacyKeyStatusTimestamp(),
        rules=[types.InputPrivacyValueAllowContacts()]
    ))
    print(result.stringify())