MadelineProtoDocs/docs/docs/CHAT_INFO.md

62 lines
2.2 KiB
Markdown
Raw Normal View History

2018-04-11 14:17:45 +02:00
---
title: Getting info about chats
description: 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.
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
---
2018-04-01 13:19:25 +02:00
# Getting info about chats
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.
2020-01-05 17:55:38 +01:00
* [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)
2019-06-27 20:29:24 +02:00
* [Just the chat ID (extremely fast)](#get_id-now-fully-async)
2018-04-01 13:19:25 +02:00
2020-01-05 17:55:38 +01:00
## getPwrChat ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
2018-04-01 13:19:25 +02:00
```php
2019-10-29 22:23:35 +01:00
$pwr_chat = yield $MadelineProto->getPwrChat(-100214891824);
2018-04-01 13:19:25 +02:00
foreach ($pwr_chat['participants'] as $participant) {
\danog\MadelineProto\Logger::log($participant);
}
```
2020-01-05 17:55:38 +01:00
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).
2018-04-01 13:19:25 +02:00
* Completeness: full
* Speed: medium
* Caching: medium
2020-01-05 17:55:38 +01:00
## getFullInfo ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
2018-04-01 13:19:25 +02:00
```php
2019-10-29 22:23:35 +01:00
$full_chat = yield $MadelineProto->getFullInfo(-10028941842);
2018-04-01 13:19:25 +02:00
```
2020-01-05 17:55:38 +01:00
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).
2018-04-01 13:19:25 +02:00
* Completeness: medium
* Speed: medium-fast
* Caching: full
2020-01-05 17:55:38 +01:00
## getInfo ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
2018-04-01 13:19:25 +02:00
```php
2019-10-29 22:23:35 +01:00
$chat = yield $MadelineProto->getInfo(-10028941842);
2018-04-01 13:19:25 +02:00
```
2020-01-05 17:55:38 +01:00
You can also use `getInfo` to get chat info, see [here for the parameters and the result](https://docs.madelineproto.xyz/getInfo.html)
2018-04-01 13:19:25 +02:00
* Completeness: small
* Speed: very fast
* Caching: full
2019-06-27 20:29:24 +02:00
## get_id ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html))
```php
2019-10-29 22:23:35 +01:00
$id = yield $MadelineProto->getID($update);
2019-06-27 20:29:24 +02:00
```
You can also use `get_id` to get chat ID from updates, messages and other objects.
* Speed: very fast
* Caching: full
2020-01-05 17:55:38 +01:00
<a href="https://docs.madelineproto.xyz/docs/DIALOGS.html">Next section</a>