More docs
This commit is contained in:
parent
4245b4c612
commit
7421e6182d
|
@ -7,9 +7,9 @@ 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)
|
||||
* [Full chat info](#get_full_info)
|
||||
* [Reduced chat info (very fast)](#get_info)
|
||||
* [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)
|
||||
|
||||
## get_pwr_chat ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
|
||||
```php
|
||||
|
@ -47,4 +47,4 @@ You can also use `get_info` to get chat info, see [here for the parameters and t
|
|||
* 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,11 +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.
|
||||
|
||||
* [As user](#user-get_dialogs)
|
||||
* [Full dialog info](#user-get_full_dialogs)
|
||||
* [As bot](#bot-internal-peer-database)
|
||||
* [Dialog list](#get_dialogs-now-fully-async)
|
||||
* [Full dialog info](#get_full_dialogs-now-fully-async)
|
||||
|
||||
## User: get_dialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
|
||||
## get_dialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
|
||||
```php
|
||||
$dialogs = yield $MadelineProto->get_dialogs();
|
||||
foreach ($dialogs as $peer) {
|
||||
|
@ -21,28 +20,14 @@ 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/get_dialogs.html)
|
||||
|
||||
## User: get_full_dialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
|
||||
## get_full_dialogs ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
|
||||
```php
|
||||
$dialogs = yield $MadelineProto->get_full_dialogs();
|
||||
foreach ($dialogs as $dialog) {
|
||||
\danog\MadelineProto\Logger::log($dialog);
|
||||
$MadelineProto->logger($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/get_full_dialogs.html)
|
||||
|
||||
## Bot: internal peer database
|
||||
```php
|
||||
foreach ($MadelineProto->API->chats as $bot_api_id => $chat) {
|
||||
try {
|
||||
yield $MadelineProto->messages->sendMessage(['peer' => $chat, 'message' => "Hi $bot_api_id! Testing MadelineProto broadcasting!"]);
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
echo $e;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Since bots cannot run `get_dialogs`, you must make use of the internal MadelineProto database to get a list of all users, chats and channels MadelineProto has seen.
|
||||
`$MadelineProto->API->chats` contains a list of [Chat](../API_docs/types/Chat.html) and [User](../API_docs/types/User.html) objects, indexed by bot API id.
|
||||
|
||||
<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>
|
||||
|
|
|
@ -7,7 +7,7 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
|||
|
||||
There are many ways you can login with MadelineProto.
|
||||
|
||||
* [Automatic](#automatic)
|
||||
* [Automatic](#automatic-now-fully-async)
|
||||
* [Manual (user)](#manual-user)
|
||||
* [Manual (bot)](#manual-bot)
|
||||
* [Logout](#logout)
|
||||
|
|
|
@ -7,10 +7,10 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
|||
|
||||
MadelineProto provides wrappers to work with secret chats.
|
||||
|
||||
* [Requesting secret chats](#requesting-secret-chats)
|
||||
* [Accepting secret chats](#accepting-secret-chats)
|
||||
* [Checking secret chat status](#checking-secret-chat-status)
|
||||
* [Sending secret messages](#sending-secret-messages)
|
||||
* [Requesting secret chats](#requesting-secret-chats-now-fully-async)
|
||||
* [Accepting secret chats](#accepting-secret-chats-now-fully-async)
|
||||
* [Checking secret chat status](#checking-secret-chat-status-now-fully-async)
|
||||
* [Sending secret messages](#sending-secret-messages-now-fully-async)
|
||||
|
||||
## Requesting secret chats ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
|
||||
|
||||
|
@ -71,4 +71,4 @@ $secret_chat = yield $MadelineProto->get_secret_chat($chat);
|
|||
|
||||
This method gets info about a certain chat.
|
||||
|
||||
<a href="https://docs.madelineproto.xyz/docs/LUA.html">Next section</a>
|
||||
<a href="https://docs.madelineproto.xyz/docs/LUA.html">Next section</a>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: get_full_dialogs
|
||||
description: get_full_dialogs parameters, return type and example
|
||||
---
|
||||
## Method: get_dialogs
|
||||
|
||||
Gets full list of dialogs
|
||||
|
||||
### Return type: Array of [Dialog objects](API_docs/types/Dialog.md)
|
||||
|
||||
### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)):
|
||||
|
||||
|
||||
```php
|
||||
$Dialogs = yield $MadelineProto->get_full_dialogs();
|
||||
```
|
||||
|
||||
Or, if you're into Lua:
|
||||
|
||||
```lua
|
||||
Dialogs = get_full_dialogs()
|
||||
```
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
title: update_2fa
|
||||
description: Update 2FA password
|
||||
---
|
||||
## Method: update_2fa
|
||||
|
||||
The params array can contain password (current password), new_password, email (optional) and hint params.
|
||||
|
||||
### Parameters:
|
||||
|
||||
| Name | Type |
|
||||
|----------|---------------|
|
||||
|params|An array of parameters|
|
||||
|
||||
### Return type: [Bool](API_docs/types/Bool.md)
|
||||
|
||||
### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)):
|
||||
|
||||
|
||||
```php
|
||||
$result = yield $MadelineProto->update_2fa(['password' => 'current password', 'new_password' => 'New password', 'email' => 'daniil@daniil.it', 'hint' => 'ponies']);
|
||||
```
|
Loading…
Reference in New Issue