set_privacy()

Client.set_privacy()

Set account privacy rules.

Usable by Users Bots
Parameters:
  • key (:obj:`~pyrogram.enums.PrivacyKey`) – Privacy key.

  • rules (Iterable of :obj:`~pyrogram.types.InputPrivacyRule`) – List of privacy rules.

Returns:

List of :obj:`~pyrogram.types.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()])