Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Feb 26, 2020
1 parent 3b740a4 commit 1060a5b
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions docs/docs/SETTINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,32 @@ MadelineProto has lots of settings that can be used to modify the behaviour of t

```php
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
$MadelineProto->settings = $settings;
$prevSettings = $MadelineProto->getSettings();
$MadelineProto->updateSettings($newSettings);
```

`$settings` - an array that contains some other arrays, which are the settings for a specific MadelineProto function.
Here are the default values for the settings arrays and explanations for every setting:

<hr>

You can provide part of any subsetting array, that way the remaining arrays will be automagically set to default and undefined values of specified subsetting arrays will be set to the default values.
Example:

```php
$MadelineProto->updateSettings([
'authorization' => [ // Authorization settings
'default_temp_auth_key_expires_in' => 86400, // a day (for better security, lower is better), will be automatically regenerated afterwards
]
]);
```

The settings array can be accessed using the `getSettings` method of the API class:

```php
$settings = $MadelineProto->getSettings();
```

<hr>
## `$settings['authorization']`

Expand Down Expand Up @@ -420,23 +440,4 @@ Default: false
Description: Remove data from internal database to cleanup memory and reduce `*.madeline` file size (may cause MadelineProto errors).


<hr>

You can provide part of any subsetting array, that way the remaining arrays will be automagically set to default and undefined values of specified subsetting arrays will be set to the default values.
Example:

```php
$MadelineProto->settings = [
'authorization' => [ // Authorization settings
'default_temp_auth_key_expires_in' => 86400, // a day
]
]
```

The settings array can be accessed and modified in the instantiated class by accessing the `settings` attribute of the API class:

```php
$MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching
```

<a href="https://docs.madelineproto.xyz/docs/SELF.html">Next section</a>
<a href="https://docs.madelineproto.xyz/docs/SELF.html">Next section</a>

0 comments on commit 1060a5b

Please sign in to comment.