Update docs
This commit is contained in:
parent
ba3fed54b3
commit
894c213a87
@ -1,6 +1,6 @@
|
||||
---
|
||||
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
|
||||
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)
|
||||
|
||||
|
||||
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:
|
||||
|
||||
| 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)
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
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
|
||||
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)
|
||||
|
||||
|
||||
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:
|
||||
|
||||
| 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|
|
||||
|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|
|
||||
|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->update2fa($params), instead (see https://docs.madelineproto.xyz for more info) | Yes|
|
||||
|
||||
|
||||
### Return type: [Bool](../types/Bool.md)
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
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
|
||||
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)
|
||||
|
||||
|
||||
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:
|
||||
|
||||
| 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)
|
||||
|
@ -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.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>
|
||||
|
||||
@ -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="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>
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: bot_login
|
||||
description: bot_login parameters, return type and example
|
||||
title: botLogin
|
||||
description: botLogin parameters, return type and example
|
||||
redirect_from: /bot_login.html
|
||||
---
|
||||
## Method: bot_login
|
||||
## Method: botLogin
|
||||
|
||||
|
||||
### Parameters:
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: complete_2FA_login
|
||||
description: complete_2FA_login parameters, return type and example
|
||||
title: complete2falogin
|
||||
description: complete2falogin parameters, return type and example
|
||||
redirect_from: /complete_2fa_login.html
|
||||
---
|
||||
## Method: complete_2FA_login
|
||||
## Method: complete2falogin
|
||||
|
||||
|
||||
### Parameters:
|
||||
@ -23,7 +24,7 @@ if ($authorization['_'] === 'account.noPassword') {
|
||||
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
|
||||
}
|
||||
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') {
|
||||
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
title: complete_phone_login
|
||||
description: complete_phone_login parameters, return type and example
|
||||
title: completePhoneLogin
|
||||
description: completePhoneLogin parameters, return type and example
|
||||
redirect_from: /complete_phone_login.html
|
||||
---
|
||||
## 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']`
|
||||
|
||||
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)):
|
||||
|
||||
@ -25,7 +26,7 @@ if ($authorization['_'] === 'account.noPassword') {
|
||||
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
|
||||
}
|
||||
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') {
|
||||
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: complete_signup
|
||||
description: complete_signup parameters, return type and example
|
||||
title: completeSignup
|
||||
description: completeSignup parameters, return type and example
|
||||
redirect_from: /complete_signup.html
|
||||
---
|
||||
## Method: complete_signup
|
||||
## Method: completeSignup
|
||||
|
||||
|
||||
### Parameters:
|
||||
@ -24,7 +25,7 @@ if ($authorization['_'] === 'account.noPassword') {
|
||||
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
|
||||
}
|
||||
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') {
|
||||
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));
|
||||
|
@ -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.
|
||||
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.
|
||||
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.
|
||||
|
@ -90,7 +90,7 @@ If you manually set the network type to `NET_TYPE_GPRS`, `NET_TYPE_EDGE`, or ena
|
||||
|
||||
## Putting it all together
|
||||
|
||||
Requesting calls is easy, just run the `request_call` method.
|
||||
Requesting calls is easy, just run the `requestCall` method.
|
||||
|
||||
```php
|
||||
$controller = $MadelineProto->requestCall('@danogentili')->play('input.raw')->then('inputb.raw')->playOnHold(['hold.raw'])->setOutputFile('output.raw');
|
||||
|
@ -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.
|
||||
|
||||
* [Full chat info with full list of participants](#get_pwr_chat-now-fully-async)
|
||||
* [Full chat info](#get_full_info-now-fully-async)
|
||||
* [Reduced chat info (very fast)](#get_info-now-fully-async)
|
||||
* [Full chat info with full list of participants](#getPwrChat-now-fully-async)
|
||||
* [Full chat info](#getFullInfo-now-fully-async)
|
||||
* [Reduced chat info (very fast)](#getInfo-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
|
||||
$pwr_chat = yield $MadelineProto->getPwrChat(-100214891824);
|
||||
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
|
||||
* Speed: 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
|
||||
$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
|
||||
* Speed: medium-fast
|
||||
* 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
|
||||
$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
|
||||
* 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
|
||||
* 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>
|
||||
|
@ -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.
|
||||
|
||||
* [Dialog list](#get_dialogs-now-fully-async)
|
||||
* [Full dialog info](#get_full_dialogs-now-fully-async)
|
||||
* [Dialog list](#getDialogs-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
|
||||
$dialogs = yield $MadelineProto->getDialogs();
|
||||
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
|
||||
$dialogs = yield $MadelineProto->getFullDialogs();
|
||||
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>
|
@ -14,7 +14,7 @@ try {
|
||||
if ($e->rpc === 'BOT_METHOD_INVALID') {
|
||||
\danog\MadelineProto\Logger::log("Bots can't execute this method!");
|
||||
} 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]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -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: '));
|
||||
$authorization = yield $MadelineProto->completePhoneLogin(yield $MadelineProto->readline('Enter the phone code: '));
|
||||
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') {
|
||||
$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).
|
||||
Then, use `complete_phone_login` to complete the login, see [here for the parameters and the result](https://docs.madelineproto.xyz/completePhoneLogin.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 `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)
|
||||
@ -113,7 +113,7 @@ If the account does not have an account, use `complete_signup` to signup, see [h
|
||||
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.
|
||||
|
||||
@ -129,9 +129,9 @@ If you want to logout, you can use the logout function, see [here for the parame
|
||||
## Changing 2FA password
|
||||
|
||||
```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>
|
@ -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).
|
||||
|
||||
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).
|
||||
|
||||
|
@ -18,7 +18,7 @@ MadelineProto provides wrappers to work with secret chats.
|
||||
$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))
|
||||
|
@ -13,6 +13,6 @@ $me = yield $MadelineProto->getSelf();
|
||||
\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>
|
@ -368,7 +368,7 @@ Peer caching settings
|
||||
|
||||
### `$settings['peer']['full_info_cache_time']`
|
||||
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']`
|
||||
Default: false
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: get_dialogs
|
||||
description: get_dialogs parameters, return type and example
|
||||
title: getDialogs
|
||||
description: getDialogs parameters, return type and example
|
||||
redirect_from: /get_dialogs.html
|
||||
---
|
||||
## Method: get_dialogs
|
||||
## Method: getDialogs
|
||||
|
||||
Gets full list of dialogs
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: get_full_dialogs
|
||||
description: get_full_dialogs parameters, return type and example
|
||||
title: getFullDialogs
|
||||
description: getFullDialogs parameters, return type and example
|
||||
redirect_from: /get_full_dialogs.html
|
||||
---
|
||||
## Method: get_dialogs
|
||||
## Method: getDialogs
|
||||
|
||||
Gets full list of dialogs
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: get_full_info
|
||||
description: get_full_info parameters, return type and example
|
||||
title: getFullInfo
|
||||
description: getFullInfo parameters, return type and example
|
||||
redirect_from: /get_full_info.html
|
||||
---
|
||||
## Method: get_full_info
|
||||
## Method: getFullInfo
|
||||
|
||||
|
||||
### Parameters:
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: get_info
|
||||
description: get_info parameters, return type and example
|
||||
title: getInfo
|
||||
description: getInfo parameters, return type and example
|
||||
redirect_from: /get_info.html
|
||||
---
|
||||
## Method: get_info
|
||||
## Method: getInfo
|
||||
|
||||
|
||||
### Parameters:
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: get_pwr_chat
|
||||
description: get_pwr_chat parameters, return type and example
|
||||
title: getPwrChat
|
||||
description: getPwrChat parameters, return type and example
|
||||
redirect_from: /get_pwr_chat.html
|
||||
---
|
||||
## Method: get_pwr_chat
|
||||
## Method: getPwrChat
|
||||
|
||||
|
||||
### Parameters:
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: get_self
|
||||
description: get_self parameters, return type and example
|
||||
title: getSelf
|
||||
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.
|
||||
|
||||
|
@ -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)
|
||||
* [Getting progress](https://docs.madelineproto.xyz/docs/FILES.html#getting-progress)
|
||||
* [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](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_full_info-now-fully-async)
|
||||
* [Reduced chat info (very fast)](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_info-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#getFullInfo-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)
|
||||
* [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)
|
||||
* [Full dialog info](https://docs.madelineproto.xyz/docs/DIALOGS.html#get_full_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#getFullDialogs-now-fully-async)
|
||||
* [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)
|
||||
* [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.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.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/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>
|
||||
@ -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.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/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.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.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->update2fa($params), instead (see https://docs.madelineproto.xyz for more info): account.updatePasswordSettings</a>
|
||||
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
|
||||
* [Files](https://docs.madelineproto.xyz/docs/FILES.html)
|
||||
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: phone_login
|
||||
description: phone_login parameters, return type and example
|
||||
title: phoneLogin
|
||||
description: phoneLogin parameters, return type and example
|
||||
redirect_from: /phone_login.html
|
||||
---
|
||||
## Method: phone_login
|
||||
## Method: phoneLogin
|
||||
|
||||
|
||||
### Parameters:
|
||||
@ -26,7 +27,7 @@ if ($authorization['_'] === 'account.noPassword') {
|
||||
throw new \danog\MadelineProto\Exception('2FA is enabled but no password is set!');
|
||||
}
|
||||
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') {
|
||||
$authorization = yield $MadelineProto->completeSignup(readline('Please enter your first name: '), readline('Please enter your last name (can be empty): '));
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: request_secret_chat
|
||||
description: request_secret_chat parameters, return type and example
|
||||
title: requestCall
|
||||
description: requestCall parameters, return type and example
|
||||
redirect_from: /requestCall.html
|
||||
---
|
||||
## Method: request_secret_chat
|
||||
## Method: requestCall
|
||||
|
||||
|
||||
### Parameters:
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: request_secret_chat
|
||||
description: request_secret_chat parameters, return type and example
|
||||
title: requestSecretChat
|
||||
description: requestSecretChat parameters, return type and example
|
||||
redirect_from: /request_secret_chat.html
|
||||
---
|
||||
## Method: request_secret_chat
|
||||
## Method: requestSecretChat
|
||||
|
||||
|
||||
### Parameters:
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
title: update_2fa
|
||||
title: update2fa
|
||||
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.
|
||||
|
||||
@ -19,7 +20,7 @@ The params array can contain password (current password), new_password, email (o
|
||||
|
||||
```php
|
||||
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) {
|
||||
if (strpos($e->rpc, 'EMAIL_UNCONFIRMED_') !== false) {
|
||||
$Bool = yield $MadelineProto->account->confirmPasswordEmail(['code' => yield $MadelineProto->readline('Enter your email code: ')]);
|
||||
|
Loading…
Reference in New Issue
Block a user