Update docs

This commit is contained in:
Daniil Gentili 2020-01-05 17:55:38 +01:00
parent ba3fed54b3
commit 894c213a87
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
29 changed files with 112 additions and 98 deletions

View File

@ -1,6 +1,6 @@
--- ---
title: account.getPasswordSettings title: account.getPasswordSettings
description: You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) description: You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
redirect_from: /API_docs/methods/account_getPasswordSettings.html redirect_from: /API_docs/methods/account_getPasswordSettings.html
--- ---
@ -8,13 +8,13 @@ redirect_from: /API_docs/methods/account_getPasswordSettings.html
[Back to methods index](index.md) [Back to methods index](index.md)
You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)
### Parameters: ### Parameters:
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|---------------|-------------|----------| |----------|---------------|-------------|----------|
|password|[InputCheckPasswordSRP](../types/InputCheckPasswordSRP.md) | You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) | Yes| |password|[InputCheckPasswordSRP](../types/InputCheckPasswordSRP.md) | You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info) | Yes|
### Return type: [account.PasswordSettings](../types/account.PasswordSettings.md) ### Return type: [account.PasswordSettings](../types/account.PasswordSettings.md)

View File

@ -1,6 +1,6 @@
--- ---
title: account.updatePasswordSettings title: account.updatePasswordSettings
description: You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) description: You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
redirect_from: /API_docs/methods/account_updatePasswordSettings.html redirect_from: /API_docs/methods/account_updatePasswordSettings.html
--- ---
@ -8,14 +8,14 @@ redirect_from: /API_docs/methods/account_updatePasswordSettings.html
[Back to methods index](index.md) [Back to methods index](index.md)
You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info)
### Parameters: ### Parameters:
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|---------------|-------------|----------| |----------|---------------|-------------|----------|
|password|[InputCheckPasswordSRP](../types/InputCheckPasswordSRP.md) | You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) | Yes| |password|[InputCheckPasswordSRP](../types/InputCheckPasswordSRP.md) | You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info) | Yes|
|new\_settings|[account.PasswordInputSettings](../types/account.PasswordInputSettings.md) | You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) | Yes| |new\_settings|[account.PasswordInputSettings](../types/account.PasswordInputSettings.md) | You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info) | Yes|
### Return type: [Bool](../types/Bool.md) ### Return type: [Bool](../types/Bool.md)

View File

@ -1,6 +1,6 @@
--- ---
title: auth.checkPassword title: auth.checkPassword
description: You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info) description: You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info)
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
redirect_from: /API_docs/methods/auth_checkPassword.html redirect_from: /API_docs/methods/auth_checkPassword.html
--- ---
@ -8,13 +8,13 @@ redirect_from: /API_docs/methods/auth_checkPassword.html
[Back to methods index](index.md) [Back to methods index](index.md)
You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info) You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info)
### Parameters: ### Parameters:
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|---------------|-------------|----------| |----------|---------------|-------------|----------|
|password|[InputCheckPasswordSRP](../types/InputCheckPasswordSRP.md) | You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info) | Yes| |password|[InputCheckPasswordSRP](../types/InputCheckPasswordSRP.md) | You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info) | Yes|
### Return type: [auth.Authorization](../types/auth.Authorization.md) ### Return type: [auth.Authorization](../types/auth.Authorization.md)

View File

@ -632,7 +632,7 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
* <a href="auth.signUp.html" name="auth.signUp">You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info): auth.signUp</a> * <a href="auth.signUp.html" name="auth.signUp">You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info): auth.signUp</a>
* <a href="auth.checkPassword.html" name="auth.checkPassword">You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info): auth.checkPassword</a> * <a href="auth.checkPassword.html" name="auth.checkPassword">You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info): auth.checkPassword</a>
* <a href="channels.getFullChannel.html" name="channels.getFullChannel">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): channels.getFullChannel</a> * <a href="channels.getFullChannel.html" name="channels.getFullChannel">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): channels.getFullChannel</a>
@ -662,7 +662,7 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
* <a href="messages.receivedQueue.html" name="messages.receivedQueue">You cannot use this method directly: messages.receivedQueue</a> * <a href="messages.receivedQueue.html" name="messages.receivedQueue">You cannot use this method directly: messages.receivedQueue</a>
* <a href="account.getPasswordSettings.html" name="account.getPasswordSettings">You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.getPasswordSettings</a> * <a href="account.getPasswordSettings.html" name="account.getPasswordSettings">You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.getPasswordSettings</a>
* <a href="account.updatePasswordSettings.html" name="account.updatePasswordSettings">You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.updatePasswordSettings</a> * <a href="account.updatePasswordSettings.html" name="account.updatePasswordSettings">You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.updatePasswordSettings</a>

View File

@ -1,8 +1,9 @@
--- ---
title: bot_login title: botLogin
description: bot_login parameters, return type and example description: botLogin parameters, return type and example
redirect_from: /bot_login.html
--- ---
## Method: bot_login ## Method: botLogin
### Parameters: ### Parameters:

View File

@ -1,8 +1,9 @@
--- ---
title: complete_2FA_login title: complete2falogin
description: complete_2FA_login parameters, return type and example description: complete2falogin parameters, return type and example
redirect_from: /complete_2fa_login.html
--- ---
## Method: complete_2FA_login ## Method: complete2falogin
### Parameters: ### Parameters:
@ -23,7 +24,7 @@ if ($authorization['_'] === 'account.noPassword') {
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
} }
if ($authorization['_'] === 'account.password') { if ($authorization['_'] === 'account.password') {
$authorization = yield $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); $authorization = yield $MadelineProto->complete2falogin(readline('Please enter your password (hint '.$authorization['hint'].'): '));
} }
if ($authorization['_'] === 'account.needSignup') { if ($authorization['_'] === 'account.needSignup') {
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); $authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));

View File

@ -1,6 +1,7 @@
--- ---
title: complete_phone_login title: completePhoneLogin
description: complete_phone_login parameters, return type and example description: completePhoneLogin parameters, return type and example
redirect_from: /complete_phone_login.html
--- ---
## Method: complete\_phone\_login ## Method: complete\_phone\_login
@ -13,7 +14,7 @@ description: complete_phone_login parameters, return type and example
### Return type: [auth.Authorization](API_docs/types/auth_Authorization.md) or [account.Password](http://docs.madelineproto.xyz/API_docs/types/account_Password.html) or `['_' => 'account.needSignup']` ### Return type: [auth.Authorization](API_docs/types/auth_Authorization.md) or [account.Password](http://docs.madelineproto.xyz/API_docs/types/account_Password.html) or `['_' => 'account.needSignup']`
You must then use [complete_2FA_login](complete_2FA_login.md) or [completeSignup](completeSignup.md) to login or signup, or simply start using `$MadelineProto` if the result is a `auth.Authorization` object. You must then use [complete2falogin](complete2FALogin.md) or [completeSignup](completeSignup.md) to login or signup, or simply start using `$MadelineProto` if the result is a `auth.Authorization` object.
### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)): ### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)):
@ -25,7 +26,7 @@ if ($authorization['_'] === 'account.noPassword') {
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
} }
if ($authorization['_'] === 'account.password') { if ($authorization['_'] === 'account.password') {
$authorization = yield $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); $authorization = yield $MadelineProto->complete2falogin(readline('Please enter your password (hint '.$authorization['hint'].'): '));
} }
if ($authorization['_'] === 'account.needSignup') { if ($authorization['_'] === 'account.needSignup') {
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); $authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));

View File

@ -1,8 +1,9 @@
--- ---
title: complete_signup title: completeSignup
description: complete_signup parameters, return type and example description: completeSignup parameters, return type and example
redirect_from: /complete_signup.html
--- ---
## Method: complete_signup ## Method: completeSignup
### Parameters: ### Parameters:
@ -24,7 +25,7 @@ if ($authorization['_'] === 'account.noPassword') {
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
} }
if ($authorization['_'] === 'account.password') { if ($authorization['_'] === 'account.password') {
$authorization = yield $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); $authorization = yield $MadelineProto->complete2falogin(readline('Please enter your password (hint '.$authorization['hint'].'): '));
} }
if ($authorization['_'] === 'account.needSignup') { if ($authorization['_'] === 'account.needSignup') {
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); $authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));

View File

@ -94,7 +94,7 @@ $result = $sm('@danogentili', 'hi');
``` ```
This **will not work**, because the result of a function that uses `yield` is not the `return`ed value, but a [generator](https://www.php.net/manual/en/language.generators.overview.php), which is what the async AMPHP API is based on. This **will not work**, because the result of a function that uses `yield` is not the `return`ed value, but a [generator](https://www.php.net/manual/en/language.generators.overview.php), which is what the async AMPHP API is based on.
If the generator is not __passed to the AMPHP event loop__, execution of the function will not be resumed: when MadelineProto asynchronously obtains the result of the get_info, execution of the function is never resumed, and the line with sendMessage is never called. If the generator is not __passed to the AMPHP event loop__, execution of the function will not be resumed: when MadelineProto asynchronously obtains the result of the getInfo, execution of the function is never resumed, and the line with sendMessage is never called.
To avoid this problem, only call asynchronous functions in the event/callback update handler, or in functions called by the event/callback update handler, or inside a function passed to loop. To avoid this problem, only call asynchronous functions in the event/callback update handler, or in functions called by the event/callback update handler, or inside a function passed to loop.
You can also call asynchronous functions created by you, within other asynchronous functions. You can also call asynchronous functions created by you, within other asynchronous functions.
Generators in MadelineProto are equivalent to promises, which is a paradigm you may have used in other languages. Generators in MadelineProto are equivalent to promises, which is a paradigm you may have used in other languages.

View File

@ -90,7 +90,7 @@ If you manually set the network type to `NET_TYPE_GPRS`, `NET_TYPE_EDGE`, or ena
## Putting it all together ## Putting it all together
Requesting calls is easy, just run the `request_call` method. Requesting calls is easy, just run the `requestCall` method.
```php ```php
$controller = $MadelineProto->requestCall('@danogentili')->play('input.raw')->then('inputb.raw')->playOnHold(['hold.raw'])->setOutputFile('output.raw'); $controller = $MadelineProto->requestCall('@danogentili')->play('input.raw')->then('inputb.raw')->playOnHold(['hold.raw'])->setOutputFile('output.raw');

View File

@ -7,12 +7,12 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
There are various methods that can be used to fetch info about chats, based on bot API id, tg-cli ID, Peer, User, Chat objects. There are various methods that can be used to fetch info about chats, based on bot API id, tg-cli ID, Peer, User, Chat objects.
* [Full chat info with full list of participants](#get_pwr_chat-now-fully-async) * [Full chat info with full list of participants](#getPwrChat-now-fully-async)
* [Full chat info](#get_full_info-now-fully-async) * [Full chat info](#getFullInfo-now-fully-async)
* [Reduced chat info (very fast)](#get_info-now-fully-async) * [Reduced chat info (very fast)](#getInfo-now-fully-async)
* [Just the chat ID (extremely fast)](#get_id-now-fully-async) * [Just the chat ID (extremely fast)](#get_id-now-fully-async)
## get_pwr_chat ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)) ## getPwrChat ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
```php ```php
$pwr_chat = yield $MadelineProto->getPwrChat(-100214891824); $pwr_chat = yield $MadelineProto->getPwrChat(-100214891824);
foreach ($pwr_chat['participants'] as $participant) { foreach ($pwr_chat['participants'] as $participant) {
@ -20,29 +20,29 @@ foreach ($pwr_chat['participants'] as $participant) {
} }
``` ```
Use `get_pwr_chat` to get full chat info, including the full list of members, see [here for the parameters and the result](https://docs.madelineproto.xyz/getPwrChat.html). Use `getPwrChat` to get full chat info, including the full list of members, see [here for the parameters and the result](https://docs.madelineproto.xyz/getPwrChat.html).
* Completeness: full * Completeness: full
* Speed: medium * Speed: medium
* Caching: medium * Caching: medium
## get_full_info ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)) ## getFullInfo ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
```php ```php
$full_chat = yield $MadelineProto->getFullInfo(-10028941842); $full_chat = yield $MadelineProto->getFullInfo(-10028941842);
``` ```
You can also use `get_full_info` to get full chat info, without the full list of members, see [here for the parameters and the result](https://docs.madelineproto.xyz/getFullInfo.html). You can also use `getFullInfo` to get full chat info, without the full list of members, see [here for the parameters and the result](https://docs.madelineproto.xyz/getFullInfo.html).
* Completeness: medium * Completeness: medium
* Speed: medium-fast * Speed: medium-fast
* Caching: full * Caching: full
## get_info ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)) ## getInfo ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
```php ```php
$chat = yield $MadelineProto->getInfo(-10028941842); $chat = yield $MadelineProto->getInfo(-10028941842);
``` ```
You can also use `get_info` to get chat info, see [here for the parameters and the result](https://docs.madelineproto.xyz/getInfo.html) You can also use `getInfo` to get chat info, see [here for the parameters and the result](https://docs.madelineproto.xyz/getInfo.html)
* Completeness: small * Completeness: small
* Speed: very fast * Speed: very fast
@ -58,4 +58,4 @@ You can also use `get_id` to get chat ID from updates, messages and other object
* Speed: very fast * Speed: very fast
* Caching: full * Caching: full
<a href="https://docs.madelineproto.xyz/docs/DIALOGS.html">Next section</a> <a href="https://docs.madelineproto.xyz/docs/DIALOGS.html">Next section</a>

View File

@ -7,10 +7,10 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
There are two ways to get a list of all chats, depending if you logged in as a user, or as a bot. There are two ways to get a list of all chats, depending if you logged in as a user, or as a bot.
* [Dialog list](#get_dialogs-now-fully-async) * [Dialog list](#getDialogs-now-fully-async)
* [Full dialog info](#get_full_dialogs-now-fully-async) * [Full dialog info](#getFullDialogs-now-fully-async)
## get_dialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)) ## getDialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
```php ```php
$dialogs = yield $MadelineProto->getDialogs(); $dialogs = yield $MadelineProto->getDialogs();
foreach ($dialogs as $peer) { foreach ($dialogs as $peer) {
@ -18,9 +18,9 @@ foreach ($dialogs as $peer) {
} }
``` ```
`get_dialogs` will return a full list of all chats you're member of, see [here for the parameters and the result](https://docs.madelineproto.xyz/getDialogs.html) `getDialogs` will return a full list of all chats you're member of, see [here for the parameters and the result](https://docs.madelineproto.xyz/getDialogs.html)
## get_full_dialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)) ## getFullDialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
```php ```php
$dialogs = yield $MadelineProto->getFullDialogs(); $dialogs = yield $MadelineProto->getFullDialogs();
foreach ($dialogs as $dialog) { foreach ($dialogs as $dialog) {
@ -28,6 +28,6 @@ foreach ($dialogs as $dialog) {
} }
``` ```
`get_full_dialogs` will return a full list of all chats you're member of, including dialog info (such as the pinned/last message ID, unread count, tag count, notification settings and message drafts) see [here for the parameters and the result](https://docs.madelineproto.xyz/getFullDialogs.html) `getFullDialogs` will return a full list of all chats you're member of, including dialog info (such as the pinned/last message ID, unread count, tag count, notification settings and message drafts) see [here for the parameters and the result](https://docs.madelineproto.xyz/getFullDialogs.html)
<a href="https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html">Next section</a> <a href="https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html">Next section</a>

View File

@ -14,7 +14,7 @@ try {
if ($e->rpc === 'BOT_METHOD_INVALID') { if ($e->rpc === 'BOT_METHOD_INVALID') {
\danog\MadelineProto\Logger::log("Bots can't execute this method!"); \danog\MadelineProto\Logger::log("Bots can't execute this method!");
} else { } else {
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => 'An error occurred while calling get_dialogs: '.$e]); $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => 'An error occurred while calling getDialogs: '.$e]);
} }
} }
``` ```

View File

@ -92,19 +92,19 @@ After you provide an API ID, you can then login (if you're using the [automatic
yield $MadelineProto->phoneLogin(yield $MadelineProto->readline('Enter your phone number: ')); yield $MadelineProto->phoneLogin(yield $MadelineProto->readline('Enter your phone number: '));
$authorization = yield $MadelineProto->completePhoneLogin(yield $MadelineProto->readline('Enter the phone code: ')); $authorization = yield $MadelineProto->completePhoneLogin(yield $MadelineProto->readline('Enter the phone code: '));
if ($authorization['_'] === 'account.password') { if ($authorization['_'] === 'account.password') {
$authorization = yield $MadelineProto->complete_2fa_login(yield $MadelineProto->readline('Please enter your password (hint '.$authorization['hint'].'): ')); $authorization = yield $MadelineProto->complete2falogin(yield $MadelineProto->readline('Please enter your password (hint '.$authorization['hint'].'): '));
} }
if ($authorization['_'] === 'account.needSignup') { if ($authorization['_'] === 'account.needSignup') {
$authorization = yield $MadelineProto->completeSignup(yield $MadelineProto->readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); $authorization = yield $MadelineProto->completeSignup(yield $MadelineProto->readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));
} }
``` ```
First, you must call `phone_login` to send the verification code, see [here for the parameters and the result](https://docs.madelineproto.xyz/phoneLogin.html). First, you must call `phoneLogin` to send the verification code, see [here for the parameters and the result](https://docs.madelineproto.xyz/phoneLogin.html).
Then, use `complete_phone_login` to complete the login, see [here for the parameters and the result](https://docs.madelineproto.xyz/completePhoneLogin.html). Then, use `completePhoneLogin` to complete the login, see [here for the parameters and the result](https://docs.madelineproto.xyz/completePhoneLogin.html).
Use `complete_2FA_login` to complete the login to an account with 2FA enabled, see [here for the parameters and the result](https://docs.madelineproto.xyz/complete_2FA_login.html). Use `complete2falogin` to complete the login to an account with 2FA enabled, see [here for the parameters and the result](https://docs.madelineproto.xyz/complete2falogin.html).
If the account does not have an account, use `complete_signup` to signup, see [here for the parameters and the result](https://docs.madelineproto.xyz/completeSignup.html). If the account does not have an account, use `completeSignup` to signup, see [here for the parameters and the result](https://docs.madelineproto.xyz/completeSignup.html).
## Manual (bot) ## Manual (bot)
@ -113,7 +113,7 @@ If the account does not have an account, use `complete_signup` to signup, see [h
yield $MadelineProto->botLogin('34298141894:aflknsaflknLKNFS'); yield $MadelineProto->botLogin('34298141894:aflknsaflknLKNFS');
``` ```
Use `bot_login` to login as a bot, see [here for the parameters and the result](https://docs.madelineproto.xyz/botLogin.html). Use `botLogin` to login as a bot, see [here for the parameters and the result](https://docs.madelineproto.xyz/botLogin.html).
Note that when you login as a bot, MadelineProto also logins using the [PWRTelegram](https://pwrtelegram.xyz) API, to allow persistant storage of peers, even after a logout and another login. Note that when you login as a bot, MadelineProto also logins using the [PWRTelegram](https://pwrtelegram.xyz) API, to allow persistant storage of peers, even after a logout and another login.
@ -129,9 +129,9 @@ If you want to logout, you can use the logout function, see [here for the parame
## Changing 2FA password ## Changing 2FA password
```php ```php
$result = yield $MadelineProto->update_2fa(['password' => 'current password', 'new_password' => 'New password', 'email' => 'daniil@daniil.it', 'hint' => 'ponies']); $result = yield $MadelineProto->update2fa(['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). If you want to logout, you can use the update2fa function, see [here for the parameters and the result](https://docs.madelineproto.xyz/update2fa.html).
<a href="https://docs.madelineproto.xyz/docs/FEATURES.html">Next section</a> <a href="https://docs.madelineproto.xyz/docs/FEATURES.html">Next section</a>

View File

@ -18,7 +18,7 @@ By assigning a callable to an attribute, you're actually assigning a new functio
Passing lua callables to a parameter of a PHP callable will throw an exception due to a bug in the PHP lua extension that I gotta fix (so passing the usual cb and cb_extra parameters to the td-cli wrappers isn't yet possible). Passing lua callables to a parameter of a PHP callable will throw an exception due to a bug in the PHP lua extension that I gotta fix (so passing the usual cb and cb_extra parameters to the td-cli wrappers isn't yet possible).
All MadelineProto wrapper methods (for example upload, download, upload_encrypted, get_self, and others) are imported in the Lua environment, as well as all MTProto wrappers (see the API docs for more info). All MadelineProto wrapper methods (for example upload, download, upload_encrypted, getSelf, and others) are imported in the Lua environment, as well as all MTProto wrappers (see the API docs for more info).
td-cli wrappers are also present: you can use the tdcli_function in lua and pass mtproto updates to the tdcli_update_callback via PHP, they will be automatically converted to/from td objects. Please note that the object conversion is not complete, feel free to contribute to the conversion module in [`src/danog/MadelineProto/Conversion/TD.php`](https://github.com/danog/MadelineProto/raw/master/src/danog/MadelineProto/TL/Conversion/TD.php). td-cli wrappers are also present: you can use the tdcli_function in lua and pass mtproto updates to the tdcli_update_callback via PHP, they will be automatically converted to/from td objects. Please note that the object conversion is not complete, feel free to contribute to the conversion module in [`src/danog/MadelineProto/Conversion/TD.php`](https://github.com/danog/MadelineProto/raw/master/src/danog/MadelineProto/TL/Conversion/TD.php).

View File

@ -18,7 +18,7 @@ MadelineProto provides wrappers to work with secret chats.
$secret_chat = yield $MadelineProto->requestSecretChat($InputUser); $secret_chat = yield $MadelineProto->requestSecretChat($InputUser);
``` ```
[`request_secret_chat`](https://docs.madelineproto.xyz/requestSecretChat.html) requests a secret secret chat to the [InputUser](https://docs.madelineproto.xyz/API_docs/types/InputUser.html), ID, or username specified, and returns the secret chat ID. [`requestSecretChat`](https://docs.madelineproto.xyz/requestSecretChat.html) requests a secret secret chat to the [InputUser](https://docs.madelineproto.xyz/API_docs/types/InputUser.html), ID, or username specified, and returns the secret chat ID.
## Accepting secret chats ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)) ## Accepting secret chats ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))

View File

@ -13,6 +13,6 @@ $me = yield $MadelineProto->getSelf();
\danog\MadelineProto\Logger::log("Hi ".$me['first_name']."!"); \danog\MadelineProto\Logger::log("Hi ".$me['first_name']."!");
``` ```
[`get_self`](https://docs.madelineproto.xyz/getSelf.html) returns a [User object](../API_docs/types/User.html) that contains info about the currently logged in user/bot, or false if the current instance is not logged in. [`getSelf`](https://docs.madelineproto.xyz/getSelf.html) returns a [User object](../API_docs/types/User.html) that contains info about the currently logged in user/bot, or false if the current instance is not logged in.
<a href="https://docs.madelineproto.xyz/docs/EXCEPTIONS.html">Next section</a> <a href="https://docs.madelineproto.xyz/docs/EXCEPTIONS.html">Next section</a>

View File

@ -368,7 +368,7 @@ Peer caching settings
### `$settings['peer']['full_info_cache_time']` ### `$settings['peer']['full_info_cache_time']`
Default: 3600 Default: 3600
Description: Cache validity of full peer info (obtained with [getFullInfo](CHAT_INFO.html#get_full_info)) Description: Cache validity of full peer info (obtained with [getFullInfo](CHAT_INFO.html#getFullInfo))
### `$settings['peer']['full_fetch']` ### `$settings['peer']['full_fetch']`
Default: false Default: false

View File

@ -1,8 +1,9 @@
--- ---
title: get_dialogs title: getDialogs
description: get_dialogs parameters, return type and example description: getDialogs parameters, return type and example
redirect_from: /get_dialogs.html
--- ---
## Method: get_dialogs ## Method: getDialogs
Gets full list of dialogs Gets full list of dialogs

View File

@ -1,8 +1,9 @@
--- ---
title: get_full_dialogs title: getFullDialogs
description: get_full_dialogs parameters, return type and example description: getFullDialogs parameters, return type and example
redirect_from: /get_full_dialogs.html
--- ---
## Method: get_dialogs ## Method: getDialogs
Gets full list of dialogs Gets full list of dialogs

View File

@ -1,8 +1,9 @@
--- ---
title: get_full_info title: getFullInfo
description: get_full_info parameters, return type and example description: getFullInfo parameters, return type and example
redirect_from: /get_full_info.html
--- ---
## Method: get_full_info ## Method: getFullInfo
### Parameters: ### Parameters:

View File

@ -1,8 +1,9 @@
--- ---
title: get_info title: getInfo
description: get_info parameters, return type and example description: getInfo parameters, return type and example
redirect_from: /get_info.html
--- ---
## Method: get_info ## Method: getInfo
### Parameters: ### Parameters:

View File

@ -1,8 +1,9 @@
--- ---
title: get_pwr_chat title: getPwrChat
description: get_pwr_chat parameters, return type and example description: getPwrChat parameters, return type and example
redirect_from: /get_pwr_chat.html
--- ---
## Method: get_pwr_chat ## Method: getPwrChat
### Parameters: ### Parameters:

View File

@ -1,8 +1,9 @@
--- ---
title: get_self title: getSelf
description: get_self parameters, return type and example description: getSelf parameters, return type and example
redirect_from: /get_self.html
--- ---
## Method: get_self ## Method: getSelf
Gets info about the currently logged-in user. Gets info about the currently logged-in user.

View File

@ -135,13 +135,13 @@ You can find examples for nearly every MadelineProto function in
* [Download to browser (streaming)](https://docs.madelineproto.xyz/docs/FILES.html#download-to-browser-with-streams) * [Download to browser (streaming)](https://docs.madelineproto.xyz/docs/FILES.html#download-to-browser-with-streams)
* [Getting progress](https://docs.madelineproto.xyz/docs/FILES.html#getting-progress) * [Getting progress](https://docs.madelineproto.xyz/docs/FILES.html#getting-progress)
* [Getting info about chats](https://docs.madelineproto.xyz/docs/CHAT_INFO.html) * [Getting info about chats](https://docs.madelineproto.xyz/docs/CHAT_INFO.html)
* [Full chat info with full list of participants](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_pwr_chat-now-fully-async) * [Full chat info with full list of participants](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#getPwrChat-now-fully-async)
* [Full chat info](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_full_info-now-fully-async) * [Full chat info](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#getFullInfo-now-fully-async)
* [Reduced chat info (very fast)](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_info-now-fully-async) * [Reduced chat info (very fast)](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#getInfo-now-fully-async)
* [Just the chat ID (extremely fast)](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_id-now-fully-async) * [Just the chat ID (extremely fast)](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_id-now-fully-async)
* [Getting all chats (dialogs)](https://docs.madelineproto.xyz/docs/DIALOGS.html) * [Getting all chats (dialogs)](https://docs.madelineproto.xyz/docs/DIALOGS.html)
* [Dialog list](https://docs.madelineproto.xyz/docs/DIALOGS.html#get_dialogs-now-fully-async) * [Dialog list](https://docs.madelineproto.xyz/docs/DIALOGS.html#getDialogs-now-fully-async)
* [Full dialog info](https://docs.madelineproto.xyz/docs/DIALOGS.html#get_full_dialogs-now-fully-async) * [Full dialog info](https://docs.madelineproto.xyz/docs/DIALOGS.html#getFullDialogs-now-fully-async)
* [Inline buttons ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))](https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html) * [Inline buttons ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))](https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html)
* [Secret chats](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html) * [Secret chats](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html)
* [Requesting secret chats](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html#requesting-secret-chats-now-fully-async) * [Requesting secret chats](https://docs.madelineproto.xyz/docs/SECRET_CHATS.html#requesting-secret-chats-now-fully-async)
@ -496,7 +496,7 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.importBotAuthorization.html" name="auth.importBotAuthorization">You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info): auth.importBotAuthorization</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.importBotAuthorization.html" name="auth.importBotAuthorization">You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info): auth.importBotAuthorization</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.signIn.html" name="auth.signIn">You cannot use this method directly, use the completePhoneLogin method instead (see https://docs.madelineproto.xyz for more info): auth.signIn</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.signIn.html" name="auth.signIn">You cannot use this method directly, use the completePhoneLogin method instead (see https://docs.madelineproto.xyz for more info): auth.signIn</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.signUp.html" name="auth.signUp">You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info): auth.signUp</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.signUp.html" name="auth.signUp">You cannot use this method directly, use the completeSignup method instead (see https://docs.madelineproto.xyz for more info): auth.signUp</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.checkPassword.html" name="auth.checkPassword">You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info): auth.checkPassword</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/auth.checkPassword.html" name="auth.checkPassword">You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info): auth.checkPassword</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getFullChannel.html" name="channels.getFullChannel">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): channels.getFullChannel</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.getFullChannel.html" name="channels.getFullChannel">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): channels.getFullChannel</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFullChat.html" name="messages.getFullChat">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): messages.getFullChat</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFullChat.html" name="messages.getFullChat">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): messages.getFullChat</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/users.getFullUser.html" name="users.getFullUser">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): users.getFullUser</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/users.getFullUser.html" name="users.getFullUser">You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info): users.getFullUser</a>
@ -511,8 +511,8 @@ You can find examples for nearly every MadelineProto function in
* <a href="https://docs.madelineproto.xyz/API_docs/methods/upload.saveBigFilePart.html" name="upload.saveBigFilePart">You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info: upload.saveBigFilePart</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/upload.saveBigFilePart.html" name="upload.saveBigFilePart">You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info: upload.saveBigFilePart</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/upload.saveFilePart.html" name="upload.saveFilePart">You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info: upload.saveFilePart</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/upload.saveFilePart.html" name="upload.saveFilePart">You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info: upload.saveFilePart</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.receivedQueue.html" name="messages.receivedQueue">You cannot use this method directly: messages.receivedQueue</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.receivedQueue.html" name="messages.receivedQueue">You cannot use this method directly: messages.receivedQueue</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getPasswordSettings.html" name="account.getPasswordSettings">You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.getPasswordSettings</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getPasswordSettings.html" name="account.getPasswordSettings">You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.getPasswordSettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.updatePasswordSettings.html" name="account.updatePasswordSettings">You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.updatePasswordSettings</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.updatePasswordSettings.html" name="account.updatePasswordSettings">You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.updatePasswordSettings</a>
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers) * [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
* [Files](https://docs.madelineproto.xyz/docs/FILES.html) * [Files](https://docs.madelineproto.xyz/docs/FILES.html)
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats) * [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)

View File

@ -1,8 +1,9 @@
--- ---
title: phone_login title: phoneLogin
description: phone_login parameters, return type and example description: phoneLogin parameters, return type and example
redirect_from: /phone_login.html
--- ---
## Method: phone_login ## Method: phoneLogin
### Parameters: ### Parameters:
@ -26,7 +27,7 @@ if ($authorization['_'] === 'account.noPassword') {
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!'); throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
} }
if ($authorization['_'] === 'account.password') { if ($authorization['_'] === 'account.password') {
$authorization = yield $MadelineProto->complete_2fa_login(readline('Please enter your password (hint '.$authorization['hint'].'): ')); $authorization = yield $MadelineProto->complete2falogin(readline('Please enter your password (hint '.$authorization['hint'].'): '));
} }
if ($authorization['_'] === 'account.needSignup') { if ($authorization['_'] === 'account.needSignup') {
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): ')); $authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));

View File

@ -1,8 +1,9 @@
--- ---
title: request_secret_chat title: requestCall
description: request_secret_chat parameters, return type and example description: requestCall parameters, return type and example
redirect_from: /requestCall.html
--- ---
## Method: request_secret_chat ## Method: requestCall
### Parameters: ### Parameters:

View File

@ -1,8 +1,9 @@
--- ---
title: request_secret_chat title: requestSecretChat
description: request_secret_chat parameters, return type and example description: requestSecretChat parameters, return type and example
redirect_from: /request_secret_chat.html
--- ---
## Method: request_secret_chat ## Method: requestSecretChat
### Parameters: ### Parameters:

View File

@ -1,8 +1,9 @@
--- ---
title: update_2fa title: update2fa
description: Update 2FA password description: Update 2FA password
redirect_from: /update_2fa.html
--- ---
## Method: update_2fa ## Method: update2fa
The params array can contain password (current password), new_password, email (optional) and hint params. The params array can contain password (current password), new_password, email (optional) and hint params.
@ -19,7 +20,7 @@ The params array can contain password (current password), new_password, email (o
```php ```php
try { try {
$MadelineProto->update_2fa(['password' => 'current password', 'new_password' => 'New password', 'email' => 'daniil@daniil.it', 'hint' => 'ponies']); $MadelineProto->update2fa(['password' => 'current password', 'new_password' => 'New password', 'email' => 'daniil@daniil.it', 'hint' => 'ponies']);
} catch (RPCErrorException $e) { } catch (RPCErrorException $e) {
if (strpos($e->rpc, 'EMAIL_UNCONFIRMED_') !== false) { if (strpos($e->rpc, 'EMAIL_UNCONFIRMED_') !== false) {
$Bool = yield $MadelineProto->account->confirmPasswordEmail(['code' => yield $MadelineProto->readline('Enter your email code: ')]); $Bool = yield $MadelineProto->account->confirmPasswordEmail(['code' => yield $MadelineProto->readline('Enter your email code: ')]);