From 4245b4c61275d2311476bb8c8d1c2f3b7257c42d Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 4 Jun 2019 23:20:05 +0200 Subject: [PATCH] Updating docs --- docs/docs/ASYNC.md | 5 +++++ docs/docs/EXCEPTIONS.md | 18 ++++++++++-------- docs/docs/LOGIN.md | 14 ++++++++++++-- docs/docs/SETTINGS.md | 4 ++-- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/docs/docs/ASYNC.md b/docs/docs/ASYNC.md index f2b6c3d2..a6f08634 100644 --- a/docs/docs/ASYNC.md +++ b/docs/docs/ASYNC.md @@ -219,6 +219,11 @@ $client = $MadelineProto->getHTTPClient(); From here it's like in the [artax docs](https://amphp.org/artax). +MadelineProto also provides a simplified async version of `file_get_contents`: +```php +$result = yield $MadelineProto->file_get_contents('https://myurl'); +``` + #### Async forking (does async single-thread forking) Useful if you need to start a process in the background and you want throwed exceptions to surface up. diff --git a/docs/docs/EXCEPTIONS.md b/docs/docs/EXCEPTIONS.md index 5aceddac..6d7d929b 100644 --- a/docs/docs/EXCEPTIONS.md +++ b/docs/docs/EXCEPTIONS.md @@ -26,19 +26,21 @@ try { ## List of exception types -* \danog\MadelineProto\Exception - Default exception, thrown when a php error occures and in a lot of other cases +* `\danog\MadelineProto\Exception` - Default exception, thrown when a php error occures and in a lot of other cases -* \danog\MadelineProto\RPCErrorException - Thrown when an RPC error occurres (an error received via the MTProto API): **note** that the error message of this exception is localized in English, and may vary: to fetch the original API error message use `$e->rpc`. +* `\danog\MadelineProto\RPCErrorException` - Thrown when an RPC error occurres (an error received via the MTProto API): **note** that the error message of this exception is localized in English, and may vary: to fetch the original API error message use `$e->rpc`. -* \danog\MadelineProto\TL\Exception - Thrown on TL serialization/deserialization errors +* `\danog\MadelineProto\TL\Exception` - Thrown on TL serialization/deserialization errors -* \danog\MadelineProto\NothingInTheSocketException - Thrown if no data can be read from the TCP socket +* `\danog\MadelineProto\ResponseException` - Thrown when an unexpected message is received through the socket -* \danog\MadelineProto\PTSException - Thrown if the PTS is unrecoverably corrupted +* `\danog\MadelineProto\NothingInTheSocketException` - Thrown if no data can be read/written on the TCP socket -* \danog\MadelineProto\SecurityException - Thrown on security problems (invalid params during generation of auth key or similar) +* `\danog\MadelineProto\PTSException` - Thrown if the PTS is unrecoverably corrupted -* \danog\MadelineProto\TL\Conversion\Exception - Thrown if some param/object can't be converted to/from bot API/TD/TD-CLI format (this includes markdown/html parsing) +* `\danog\MadelineProto\SecurityException` - Thrown on security problems (invalid params during generation of auth key or similar) + +* `\danog\MadelineProto\TL\Conversion\Exception` - Thrown if some param/object can't be converted to/from bot API/TD/TD-CLI format (this includes markdown/html parsing) ## Pretty TL trace @@ -106,4 +108,4 @@ try { } ``` -Next section \ No newline at end of file +Next section diff --git a/docs/docs/LOGIN.md b/docs/docs/LOGIN.md index dc40542f..59ea48f0 100644 --- a/docs/docs/LOGIN.md +++ b/docs/docs/LOGIN.md @@ -11,6 +11,7 @@ There are many ways you can login with MadelineProto. * [Manual (user)](#manual-user) * [Manual (bot)](#manual-bot) * [Logout](#logout) +* [Changing 2FA password](#changing-2fa-password) ## Automatic ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)) @@ -60,6 +61,15 @@ Note that when you login as a bot, MadelineProto also logins using the [PWRTeleg yield $MadelineProto->logout(); ``` -**If** you want to logout, you can use the logout function, see [here for the parameters and the result](https://docs.madelineproto.xyz/logout.html). +If you want to logout, you can use the logout function, see [here for the parameters and the result](https://docs.madelineproto.xyz/logout.html). -Next section \ No newline at end of file +## Changing 2FA password + +```php +$result = yield $MadelineProto->update_2fa(['password' => 'current password', 'new_password' => 'New password', 'email' => 'daniil@daniil.it', 'hint' => 'ponies']); +``` + +If you want to logout, you can use the update_2fa function, see [here for the parameters and the result](https://docs.madelineproto.xyz/update_2fa.html). + + +Next section diff --git a/docs/docs/SETTINGS.md b/docs/docs/SETTINGS.md index 267ba7a5..484808db 100644 --- a/docs/docs/SETTINGS.md +++ b/docs/docs/SETTINGS.md @@ -302,7 +302,7 @@ Description: How many times should I try to get a response to a query before thr Flood timeout settings ### `$settings['flood_timeout']['wait_if_lt']` -Default: 20 +Default: `10*60` Description: Sleeps if a `FLOOD_WAIT_` error is received with duration lower than this value
@@ -432,4 +432,4 @@ The settings array can be accessed and modified in the instantiated class by acc $MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching ``` -Next section \ No newline at end of file +Next section