set_privacy()

Client.set_privacy()

Set account privacy rules.

Usable by Users Bots
Parameters:
  • key (PrivacyKey) – Privacy key.

  • rules (Iterable of InputPrivacyRule) – List of privacy rules.

Returns:

List of PrivacyRule – On success, the list of privacy rules is returned.

Example

from pyrogram import enums, types

# Prevent everyone from seeing your phone number
await app.set_privacy(enums.PrivacyKey.PHONE_NUMBER, [types.InputPrivacyRuleDisallowAll()])