MadelineProtoDocs/docs/PHP/danog/MadelineProto/MTProtoTools/PeerHandler.md

214 lines
4.4 KiB
Markdown
Raw Normal View History

2020-10-15 18:42:54 +02:00
---
title: danog\MadelineProto\MTProtoTools\PeerHandler: Manages peers.
description:
---
# `danog\MadelineProto\MTProtoTools\PeerHandler`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
Manages peers.
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it).
## Method list:
* `toSupergroup(int $id): float|int`
* `fromSupergroup(int $id): float|int`
* `isSupergroup(int $id): bool`
* `addUser(array $user): \Generator`
* `peerIsset(mixed $id): \Generator`
* `getFolderId(mixed $id): ?int`
* `getId(mixed $id): int`
* `getInfo(mixed $id, bool $recursive): \Generator Info object`
* `fullChatLastUpdated(mixed $id): \Generator<int>`
* `getFullInfo(mixed $id): \Generator FullInfo object`
* `getPwrChat(mixed $id): \Generator<array> Chat object`
* `resolveUsername(string $username): \Generator`
## Methods:
### `toSupergroup(int $id): float|int`
Convert MTProto channel ID to bot API channel ID.
Parameters:
* `$id`: `int` MTProto channel ID
### `fromSupergroup(int $id): float|int`
Convert bot API channel ID to MTProto channel ID.
Parameters:
* `$id`: `int` Bot API channel ID
### `isSupergroup(int $id): bool`
Check whether provided bot API ID is a channel.
Parameters:
* `$id`: `int` Bot API ID
### `addUser(array $user): \Generator`
Add user info.
Parameters:
* `$user`: `array` User info
#### See also:
* `\Generator`
### `peerIsset(mixed $id): \Generator`
Check if peer is present in internal peer database.
Parameters:
* `$id`: `mixed` Peer
Fully typed return value:
```
\Generator<int|mixed, \Amp\Promise|array, mixed, bool>
```
#### See also:
* `\Amp\Promise`
* `\Generator`
### `getFolderId(mixed $id): ?int`
Get folder ID from object.
Parameters:
* `$id`: `mixed` Object
### `getId(mixed $id): int`
Get bot API ID from peer object.
Parameters:
* `$id`: `mixed` Peer
### `getInfo(mixed $id, bool $recursive): \Generator Info object`
Get info about peer, returns an Info object.
Parameters:
* `$id`: `mixed` Peer
* `$recursive`: `bool` Internal
Return value: Info object
Fully typed return value:
```
\Generator<int|mixed, \Amp\Promise|\Amp\Promise<string>|array, mixed, array{InputPeer: array{_: string, user_id?: mixed, access_hash?: mixed, min?: mixed, chat_id?: mixed, channel_id?: mixed}, Peer: array{_: string, user_id?: mixed, chat_id?: mixed, channel_id?: mixed}, DialogPeer: array{_: string, peer: array{_: string, user_id?: mixed, chat_id?: mixed, channel_id?: mixed}}, NotifyPeer: array{_: string, peer: array{_: string, user_id?: mixed, chat_id?: mixed, channel_id?: mixed}}, InputDialogPeer: array{_: string, peer: array{_: string, user_id?: mixed, access_hash?: mixed, min?: mixed, chat_id?: mixed, channel_id?: mixed}}, InputNotifyPeer: array{_: string, peer: array{_: string, user_id?: mixed, access_hash?: mixed, min?: mixed, chat_id?: mixed, channel_id?: mixed}}, bot_api_id: int|string, user_id?: int, chat_id?: int, channel_id?: int, InputUser?: array{_: string, user_id?: int, access_hash?: mixed, min?: bool}, InputChannel?: array{_: string, channel_id: int, access_hash: mixed, min: bool}, type: string}>
```
#### See also:
* [https://docs.madelineproto.xyz/Info.html](https://docs.madelineproto.xyz/Info.html)
* `\Amp\Promise`
* `\Generator`
### `fullChatLastUpdated(mixed $id): \Generator<int>`
When were full info for this chat last cached.
Parameters:
* `$id`: `mixed` Chat ID
#### See also:
* `\Generator`
### `getFullInfo(mixed $id): \Generator FullInfo object`
Get full info about peer, returns an FullInfo object.
Parameters:
* `$id`: `mixed` Peer
Return value: FullInfo object
Fully typed return value:
```
\Generator<int|mixed, \Amp\Promise|array, mixed, array>
```
#### See also:
* [https://docs.madelineproto.xyz/FullInfo.html](https://docs.madelineproto.xyz/FullInfo.html)
* `\Amp\Promise`
* `\Generator`
### `getPwrChat(mixed $id): \Generator<array> Chat object`
Get full info about peer (including full list of channel members), returns a Chat object.
Parameters:
* `$id`: `mixed` Peer
Return value: Chat object
#### See also:
* [https://docs.madelineproto.xyz/Chat.html](https://docs.madelineproto.xyz/Chat.html)
### `resolveUsername(string $username): \Generator`
Resolve username (use getInfo instead).
Parameters:
* `$username`: `string` Username
#### See also:
* `\Generator`
## Properties
* `$settings`: `\Settings` Settings