MadelineProto/old_docs/API_docs_v72/methods/account_setPrivacy.md

69 lines
1.5 KiB
Markdown
Raw Normal View History

2017-11-15 13:41:58 +01:00
---
title: account.setPrivacy
description: Set privacy settings
2017-11-15 13:41:58 +01:00
---
## Method: account.setPrivacy
[Back to methods index](index.md)
Set privacy settings
2017-11-15 13:41:58 +01:00
### Parameters:
| Name | Type | Required | Description |
|----------|---------------|----------|-------------|
2018-03-20 16:42:05 +01:00
|key|[CLICK ME InputPrivacyKey](../types/InputPrivacyKey.md) | Yes|Privacy setting|
|rules|Array of [CLICK ME InputPrivacyRule](../types/InputPrivacyRule.md) | Yes|Privacy settings|
2017-11-15 13:41:58 +01:00
### Return type: [account\_PrivacyRules](../types/account_PrivacyRules.md)
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PRIVACY_KEY_INVALID|The privacy key is invalid|
2018-03-20 19:57:36 +01:00
### MadelineProto Example:
2017-11-15 13:41:58 +01:00
```
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
2017-11-15 13:41:58 +01:00
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
2017-11-15 13:41:58 +01:00
$account_PrivacyRules = $MadelineProto->account->setPrivacy(['key' => InputPrivacyKey, 'rules' => [InputPrivacyRule, InputPrivacyRule], ]);
2017-11-15 13:41:58 +01:00
```
2018-03-20 19:57:36 +01:00
### [PWRTelegram HTTP API](https://pwrtelegram.xyz) example (NOT FOR MadelineProto):
2017-11-15 13:41:58 +01:00
### As a user:
POST/GET to `https://api.pwrtelegram.xyz/userTOKEN/account.setPrivacy`
Parameters:
key - Json encoded InputPrivacyKey
rules - Json encoded array of InputPrivacyRule
Or, if you're into Lua:
```
account_PrivacyRules = account.setPrivacy({key=InputPrivacyKey, rules={InputPrivacyRule}, })
```