MadelineProtoDocs/docs/PHPInternal/danog/MadelineProto/API.md

3120 lines
59 KiB
Markdown
Raw Normal View History

2020-10-15 18:42:54 +02:00
---
title: danog\MadelineProto\API: Main API wrapper for MadelineProto.
description:
---
# `danog\MadelineProto\API`
[Back to index](../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
Main API wrapper for MadelineProto.
## Constants
* `danog\MadelineProto\API::RELEASE`: Release version.
* `danog\MadelineProto\API::NOT_LOGGED_IN`: We're not logged in.
* `danog\MadelineProto\API::WAITING_CODE`: We're waiting for the login code.
* `danog\MadelineProto\API::WAITING_SIGNUP`: We're waiting for parameters to sign up.
* `danog\MadelineProto\API::WAITING_PASSWORD`: We're waiting for the 2FA password.
* `danog\MadelineProto\API::LOGGED_IN`: We're logged in.
* `danog\MadelineProto\API::SECRET_EMPTY`: Secret chat was not found.
* `danog\MadelineProto\API::SECRET_REQUESTED`: Secret chat was requested.
* `danog\MadelineProto\API::SECRET_READY`: Secret chat was found.
## Method list:
* `startAndLoop(string $eventHandler): void`
* `startAndLoopMulti(\danog\MadelineProto\API[] $instances, string[]|string $eventHandler): void`
* `startAndLoopAsync(string $eventHandler): \Generator`
* `MTProtoToBotAPI(array $data): \Amp\Promise<array>`
* `MTProtoToTd(mixed $params): \Amp\Promise`
* `MTProtoToTdcli(mixed $params): \Amp\Promise`
* `acceptCall(array $call): \Amp\Promise`
* `acceptSecretChat(array $params): \Amp\Promise`
* `acceptTos(): \Amp\Promise`
* `addUser(array $user): \Amp\Promise`
* `after(\Generator|\Promise $a, \Generator|\Promise $b): \Amp\Promise`
* `all((\Generator|\Promise)[] $promises): \Amp\Promise`
* `any((\Promise|\Generator)[] $promises): \Amp\Promise`
* `arr(mixed $params): array`
* `base64urlDecode(string $data): string`
* `base64urlEncode(string $data): string`
* `botAPIToMTProto(array $arguments): \Amp\Promise<array>`
* `botLogin(string $token): \Amp\Promise`
* `call(\Generator|\Promise|mixed $promise): \Amp\Promise`
* `callFork(\Generator|\Promise $promise, ?\Generator|\Promise $actual, string $file): \Amp\Promise|mixed`
* `callForkDefer(\Generator|\Promise $promise): void`
* `callStatus(int $id): mixed`
* `checkTos(): \Amp\Promise`
* `cleanup(): \Amp\Promise`
* `closeConnection(string $message): void`
* `complete2faLogin(string $password): \Amp\Promise`
* `completeCall(array $params): \Amp\Promise`
* `completePhoneLogin(string $code): \Amp\Promise`
* `completeSignup(string $first_name, string $last_name): \Amp\Promise`
* `confirmCall(array $params): \Amp\Promise`
* `connectToAllDcs(bool $reconnectAll): \Amp\Promise`
* `declineTos(): \Amp\Promise`
* `discardCall(array $call, array $reason, array $rating, bool $need_debug): \Amp\Promise`
* `discardSecretChat(int $chat): \Amp\Promise`
* `downloadToBrowser(array|string $messageMedia, callable $cb): \Amp\Promise`
* `downloadToCallable(mixed $messageMedia, callable|\danog\MadelineProto\FileCallbackInterface $callable, callable $cb, bool $seekable, int $offset, int $end, int $part_size): \Amp\Promise`
* `downloadToDir(mixed $messageMedia, string|\danog\MadelineProto\FileCallbackInterface $dir, callable $cb): \Amp\Promise`
* `downloadToFile(mixed $messageMedia, string|\danog\MadelineProto\FileCallbackInterface $file, callable $cb): \Amp\Promise Downloaded file path`
* `downloadToResponse(array|string $messageMedia, \ServerRequest $request, callable $cb): \Amp\Promise Returned response`
* `downloadToStream(mixed $messageMedia, mixed|\danog\MadelineProto\FileCallbackInterface $stream, callable $cb, int $offset, int $end): \Amp\Promise`
* `echo(string $string): \Amp\Promise`
* `end(array $what): mixed`
* `exportAuthorization(): \Amp\Promise`
* `extractBotAPIFile(array $info): ?array`
* `fileGetContents(string $url): \Amp\Promise`
* `first((\Promise|\Generator)[] $promises): \Amp\Promise`
* `flock(string $file, int $operation, float $polling, ?\Promise $token, ?callable $failureCb): \Amp\Promise<?callable>`
* `fromSupergroup(int $id): float|int`
* `fullChatLastUpdated(mixed $id): \Amp\Promise<int>`
* `fullGetSelf(): \Amp\Promise<array|bool>`
* `genVectorHash(array $ints): \int Vector hash`
* `getAllMethods(): mixed`
* `getAuthorization(): mixed`
* `getCachedConfig(): mixed`
* `getCall(int $call): mixed`
* `getCdnConfig(string $datacenter): \Amp\Promise`
* `getConfig(array $config, array $options): \Amp\Promise`
* `getDNSClient(): mixed`
* `getDataCenterConnections(): mixed`
* `getDataCenterId(): int|string`
* `getDialogs(bool $force): \Amp\Promise`
* `getDownloadInfo(mixed $messageMedia): \Amp\Promise<array>`
* `getEventHandler(): mixed`
* `getExtensionFromLocation(mixed $location, string $default): string`
* `getExtensionFromMime(string $mime): string`
* `getFileInfo(mixed $constructor): \Amp\Promise<array>`
* `getFolderId(mixed $id): ?int`
* `getFullDialogs(bool $force): \Amp\Promise`
* `getFullInfo(mixed $id): \Amp\Promise FullInfo object`
* `getHTTPClient(): mixed`
* `getHint(): mixed`
* `getId(mixed $id): int`
* `getInfo(mixed $id, bool $recursive): \Amp\Promise Info object`
* `getLogger()`
* `getMethodNamespaces(): mixed`
* `getMethodsNamespaced(): mixed`
* `getMimeFromBuffer(string $buffer): string`
* `getMimeFromExtension(string $extension, string $default): string`
* `getMimeFromFile(string $file): string`
* `getPropicInfo(mixed $messageMedia): \Amp\Promise<array>`
* `getPsrLogger()`
* `getPwrChat(mixed $id): \Amp\Promise<array> Chat object`
* `getSecretChat(array|int $chat): mixed`
* `getSelf(): array|bool`
* `getSettings(): mixed`
* `getTL(): mixed`
* `getVar(object $obj, string $var): mixed`
* `getWebTemplate(): mixed`
* `hasAllAuth(): mixed`
* `hasEventHandler(): mixed`
* `hasReportPeers(): mixed`
* `hasSecretChat(array|int $chat): mixed`
* `hasVar(object $obj, string $var): bool`
* `importAuthorization(mixed $authorization): \Amp\Promise`
* `inflateStripped(string $stripped): \string JPG payload`
* `initSelfRestart(): mixed`
* `isAltervista(): bool`
* `isArrayOrAlike(mixed $var): bool`
* `isIpc(): mixed`
* `isSupergroup(int $id): bool`
* `logger(string $param, int $level, string $file): mixed`
* `logout(): \Amp\Promise`
* `loop(callable|null $callback): \Amp\Promise`
* `loopFork(): \Amp\Promise`
* `markdownEscape(string $hwat): string`
* `mbStrSplit(string $text, int $length): array`
* `mbStrlen(string $text): float|int`
* `mbSubstr(string $text, int $offset, ?int $length): string`
* `methodCall(string $method, array|\Generator $args, array $aargs): \Amp\Promise`
* `methodCallWrite(string $method, array|\Generator $args, array $aargs): \Amp\Promise`
* `methodEscape(string $method): string`
* `packDouble(float $value): string`
* `packSignedInt(int $value): string`
* `packSignedLong(int $value): string`
* `packUnsignedInt(int $value): string`
* `peerIsset(mixed $id): \Amp\Promise`
* `phoneLogin(string $number, int $sms_type): \Amp\Promise`
* `posmod(int $a, int $b): \int Modulo`
* `random(int $length): \string Random string`
* `randomInt(int $modulus): int`
* `readLine(string $prompt): \Amp\Promise<string>`
* `rekey(int $chat): \Amp\Promise`
* `report(string $message, string $parseMode): \Amp\Promise`
* `requestCall(mixed $user): \Amp\Promise`
* `requestSecretChat(mixed $user): \Amp\Promise`
* `resetUpdateState(): mixed`
* `resolveUsername(string $username): \Amp\Promise`
* `restart(): void`
* `rethrow(\Throwable $e, string $file): void`
* `rleDecode(string $string): string`
* `rleEncode(string $string): string`
* `secretChatStatus(int $chat): mixed`
* `serializeAll(): void`
* `setCallback(callable $callback): mixed`
* `setEventHandler(class-string<\danog\MadelineProto\EventHandler> $eventHandler): \Amp\Promise`
* `setNoop(): mixed`
* `setReportPeers(int|string $userOrId): \Amp\Promise`
* `setVar(object $obj, string $var, mixed $val): void`
* `setWebTemplate(string $template): mixed`
* `setWebhook(string $hook_url, string $pem_path): mixed`
* `setupLogger(): mixed`
* `sleep(int|float $time): \Amp\Promise`
* `some((\Promise|\Generator)[] $promises): \Amp\Promise`
* `start(): \Amp\Promise`
* `stop(): void`
* `tdToMTProto(array $params): \Amp\Promise<array>`
* `tdToTdcli(mixed $params): mixed`
* `tdcliToTd(array $params, array $key): mixed`
* `timeout(\Generator|\Promise $promise, int $timeout): \Amp\Promise`
* `timeoutWithDefault(\Promise|\Generator $promise, int $timeout, mixed $default): \Amp\Promise<\TReturn>|\Promise<\TReturnAlt>`
* `toCamelCase(string $input): string`
* `toSnakeCase(string $input): string`
* `toSupergroup(int $id): float|int`
* `typeEscape(string $type): string`
* `unpackDouble(string $value): float`
* `unpackFileId(string $fileId): mixed`
* `unpackSignedInt(string $value): int`
* `unpackSignedLong(string $value): int`
* `unpackSignedLongString(string $value): string`
* `unsetEventHandler(bool $disableUpdateHandling): mixed`
* `update2fa(array $params): \Amp\Promise`
* `updateSettings(\danog\MadelineProto\SettingsAbstract $settings): \Amp\Promise`
* `upload(\danog\MadelineProto\FileCallbackInterface|string|array $file, string $fileName, callable $cb, bool $encrypted): \Amp\Promise`
* `uploadEncrypted(\danog\MadelineProto\FileCallbackInterface|string|array $file, string $fileName, callable $cb): \Amp\Promise`
* `uploadFromCallable(mixed $callable, int $size, string $mime, string $fileName, callable $cb, bool $seekable, bool $encrypted): \Amp\Promise`
* `uploadFromStream(mixed $stream, int $size, string $mime, string $fileName, callable $cb, bool $encrypted): \Amp\Promise`
* `uploadFromTgfile(mixed $media, callable $cb, bool $encrypted): \Amp\Promise`
* `uploadFromUrl(string|\danog\MadelineProto\FileCallbackInterface $url, int $size, string $fileName, callable $cb, bool $encrypted): \Amp\Promise`
* `wait(\Generator|\Promise $promise, bool $ignoreSignal): mixed`
* `async(bool $async): void`
* `init(): void`
* `initAsynchronously(): \Generator`
* `inited(): bool`
* `forceInit(bool $inited): void`
* `getWebAPITemplate(): string`
* `setWebAPITemplate(): void`
## Methods:
### `startAndLoop(string $eventHandler): void`
Start MadelineProto and the event handler (enables async).
Also initializes error reporting, catching and reporting all errors surfacing from the event loop.
Parameters:
* `$eventHandler`: `string` Event handler class name
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `startAndLoopMulti(\danog\MadelineProto\API[] $instances, string[]|string $eventHandler): void`
Start multiple instances of MadelineProto and the event handlers (enables async).
Parameters:
* `$instances`: `\danog\MadelineProto\API[]` Instances of madeline
* `$eventHandler`: `string[]|string` Event handler(s)
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `startAndLoopAsync(string $eventHandler): \Generator`
Start MadelineProto and the event handler (enables async).
Also initializes error reporting, catching and reporting all errors surfacing from the event loop.
Parameters:
* `$eventHandler`: `string` Event handler class name
#### See also:
* `\Generator`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `MTProtoToBotAPI(array $data): \Amp\Promise<array>`
Convert MTProto parameters to bot API parameters.
Parameters:
* `$data`: `array` Data
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `MTProtoToTd(mixed $params): \Amp\Promise`
MTProto to TD params.
Parameters:
* `$params`: `mixed` Params
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `MTProtoToTdcli(mixed $params): \Amp\Promise`
MTProto to TDCLI params.
Parameters:
* `$params`: `mixed` Params
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `acceptCall(array $call): \Amp\Promise`
Accept call.
Parameters:
* `$call`: `array` Call
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `acceptSecretChat(array $params): \Amp\Promise`
Accept secret chat.
Parameters:
* `$params`: `array` Secret chat ID
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `acceptTos(): \Amp\Promise`
Accept terms of service update.
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `addUser(array $user): \Amp\Promise`
Add user info.
Parameters:
* `$user`: `array` User info
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `after(\Generator|\Promise $a, \Generator|\Promise $b): \Amp\Promise`
Call promise $b after promise $a.
Parameters:
* `$a`: `\Generator|\Promise` Promise A
* `$b`: `\Generator|\Promise` Promise B
#### See also:
* `\Generator`
* `\Promise`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `all((\Generator|\Promise)[] $promises): \Amp\Promise`
Returns a promise that succeeds when all promises succeed, and fails if any promise fails.
Returned promise succeeds with an array of values used to succeed each contained promise, with keys corresponding to the array of promises.
Parameters:
* `$promises`: `(\Generator|\Promise)[]` Promises
#### See also:
* `\Generator`
* `\Promise`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `any((\Promise|\Generator)[] $promises): \Amp\Promise`
Returns a promise that is resolved when all promises are resolved. The returned promise will not fail.
Parameters:
* `$promises`: `(\Promise|\Generator)[]` Promises
#### See also:
* `\Promise`
* `\Generator`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `arr(mixed $params): array`
Create array.
Parameters:
* `$params`: `mixed` Params
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `base64urlDecode(string $data): string`
base64URL decode.
Parameters:
* `$data`: `string` Data to decode
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `base64urlEncode(string $data): string`
Base64URL encode.
Parameters:
* `$data`: `string` Data to encode
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `botAPIToMTProto(array $arguments): \Amp\Promise<array>`
Convert bot API parameters to MTProto parameters.
Parameters:
* `$arguments`: `array` Arguments
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `botLogin(string $token): \Amp\Promise`
Login as bot.
Parameters:
* `$token`: `string` Bot token
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `call(\Generator|\Promise|mixed $promise): \Amp\Promise`
Convert generator, promise or any other value to a promise.
Parameters:
* `$promise`: `\Generator|\Promise|mixed`
Full type:
```
\Generator<mixed, mixed, mixed, \TReturn>|\Promise<\TReturn>|\TReturn
```
Fully typed return value:
```
\Promise<\TReturn>
```
#### See also:
* `\Generator`
* `\Promise`
* `\TReturn`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `callFork(\Generator|\Promise $promise, ?\Generator|\Promise $actual, string $file): \Amp\Promise|mixed`
Call promise in background.
Parameters:
* `$promise`: `\Generator|\Promise` Promise to resolve
* `$actual`: `?\Generator|\Promise` Promise to resolve instead of $promise
* `$file`: `string` File
#### See also:
* `\Generator`
* `\Promise`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `callForkDefer(\Generator|\Promise $promise): void`
Call promise in background, deferring execution.
Parameters:
* `$promise`: `\Generator|\Promise` Promise to resolve
#### See also:
* `\Generator`
* `\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `callStatus(int $id): mixed`
Get call status.
Parameters:
* `$id`: `int` Call ID
Fully typed return value:
```
int|\Amp\Promise<int>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `checkTos(): \Amp\Promise`
Check for terms of service update.
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `cleanup(): \Amp\Promise`
Cleanup memory and session file.
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `closeConnection(string $message): void`
Close connection with client, connected via web.
Parameters:
* `$message`: `string` Message
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `complete2faLogin(string $password): \Amp\Promise`
Complete 2FA login.
Parameters:
* `$password`: `string` Password
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `completeCall(array $params): \Amp\Promise`
Complete call handshake.
Parameters:
* `$params`: `array` Params
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `completePhoneLogin(string $code): \Amp\Promise`
Complet user login using login code.
Parameters:
* `$code`: `string` Login code
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `completeSignup(string $first_name, string $last_name): \Amp\Promise`
Complete signup to Telegram.
Parameters:
* `$first_name`: `string` First name
* `$last_name`: `string` Last name
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `confirmCall(array $params): \Amp\Promise`
Confirm call.
Parameters:
* `$params`: `array` Params
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `connectToAllDcs(bool $reconnectAll): \Amp\Promise`
Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info.
Parameters:
* `$reconnectAll`: `bool` Whether to reconnect to all DCs
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `declineTos(): \Amp\Promise`
Decline terms of service update.
THIS WILL DELETE YOUR ACCOUNT!
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `discardCall(array $call, array $reason, array $rating, bool $need_debug): \Amp\Promise`
Discard call.
Parameters:
* `$call`: `array` Call
* `$reason`: `array`
* `$rating`: `array` Rating
* `$need_debug`: `bool` Need debug?
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `discardSecretChat(int $chat): \Amp\Promise`
Discard secret chat.
Parameters:
* `$chat`: `int` Secret chat ID
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `downloadToBrowser(array|string $messageMedia, callable $cb): \Amp\Promise`
Download file to browser.
Supports HEAD requests and content-ranges for parallel and resumed downloads.
Parameters:
* `$messageMedia`: `array|string` File to download
* `$cb`: `callable` Status callback (can also use FileCallback)
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `downloadToCallable(mixed $messageMedia, callable|\danog\MadelineProto\FileCallbackInterface $callable, callable $cb, bool $seekable, int $offset, int $end, int $part_size): \Amp\Promise`
Download file to callable.
The callable must accept two parameters: string $payload, int $offset
The callable will be called (possibly out of order, depending on the value of $seekable).
The callable should return the number of written bytes.
Parameters:
* `$messageMedia`: `mixed` File to download
* `$callable`: `callable|\danog\MadelineProto\FileCallbackInterface` Chunk callback
* `$cb`: `callable` Status callback (DEPRECATED, use FileCallbackInterface)
* `$seekable`: `bool` Whether the callable can be called out of order
* `$offset`: `int` Offset where to start downloading
* `$end`: `int` Offset where to stop downloading (inclusive)
* `$part_size`: `int` Size of each chunk
Fully typed return value:
```
\Amp\Promise<true>
```
#### See also:
* [`\danog\MadelineProto\FileCallbackInterface`: File callback interface.](./FileCallbackInterface.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `downloadToDir(mixed $messageMedia, string|\danog\MadelineProto\FileCallbackInterface $dir, callable $cb): \Amp\Promise`
Download file to directory.
Parameters:
* `$messageMedia`: `mixed` File to download
* `$dir`: `string|\danog\MadelineProto\FileCallbackInterface` Directory where to download the file
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
Fully typed return value:
```
\Amp\Promise<false|string>
```
#### See also:
* [`\danog\MadelineProto\FileCallbackInterface`: File callback interface.](./FileCallbackInterface.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `downloadToFile(mixed $messageMedia, string|\danog\MadelineProto\FileCallbackInterface $file, callable $cb): \Amp\Promise Downloaded file path`
Download file.
Parameters:
* `$messageMedia`: `mixed` File to download
* `$file`: `string|\danog\MadelineProto\FileCallbackInterface` Downloaded file path
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
Return value: Downloaded file path
Fully typed return value:
```
\Amp\Promise<false|string>
```
#### See also:
* [`\danog\MadelineProto\FileCallbackInterface`: File callback interface.](./FileCallbackInterface.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `downloadToResponse(array|string $messageMedia, \ServerRequest $request, callable $cb): \Amp\Promise Returned response`
Download file to amphp/http-server response.
Supports HEAD requests and content-ranges for parallel and resumed downloads.
Parameters:
* `$messageMedia`: `array|string` File to download
* `$request`: `\ServerRequest` Request
* `$cb`: `callable` Status callback (can also use FileCallback)
Return value: Returned response
Fully typed return value:
```
\Amp\Promise<\Amp\Http\Server\Response>
```
#### See also:
* `\ServerRequest`
* `\Amp\Http\Server\Response`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `downloadToStream(mixed $messageMedia, mixed|\danog\MadelineProto\FileCallbackInterface $stream, callable $cb, int $offset, int $end): \Amp\Promise`
Download file to stream.
Parameters:
* `$messageMedia`: `mixed` File to download
* `$stream`: `mixed|\danog\MadelineProto\FileCallbackInterface` Stream where to download file
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
* `$offset`: `int` Offset where to start downloading
* `$end`: `int` Offset where to end download
Fully typed return value:
```
\Amp\Promise<mixed>
```
#### See also:
* [`\danog\MadelineProto\FileCallbackInterface`: File callback interface.](./FileCallbackInterface.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `echo(string $string): \Amp\Promise`
Asynchronously write to stdout/browser.
Parameters:
* `$string`: `string` Message to echo
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `end(array $what): mixed`
Get final element of array.
Parameters:
* `$what`: `array` Array
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `exportAuthorization(): \Amp\Promise`
Export authorization.
Fully typed return value:
```
\Amp\Promise<array{0: int|string, 1: string}>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `extractBotAPIFile(array $info): ?array`
Extract file info from bot API message.
Parameters:
* `$info`: `array` Bot API message object
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `fileGetContents(string $url): \Amp\Promise`
Get contents of remote file asynchronously.
Parameters:
* `$url`: `string` URL
Fully typed return value:
```
\Amp\Promise<string>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `first((\Promise|\Generator)[] $promises): \Amp\Promise`
Returns a promise that succeeds when the first promise succeeds, and fails only if all promises fail.
Parameters:
* `$promises`: `(\Promise|\Generator)[]` Promises
#### See also:
* `\Promise`
* `\Generator`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `flock(string $file, int $operation, float $polling, ?\Promise $token, ?callable $failureCb): \Amp\Promise<?callable>`
Asynchronously lock a file
Resolves with a callbable that MUST eventually be called in order to release the lock.
Parameters:
* `$file`: `string` File to lock
* `$operation`: `int` Locking mode
* `$polling`: `float` Polling interval
* `$token`: `?\Promise` Cancellation token
* `$failureCb`: `?callable` Failure callback, called only once if the first locking attempt fails.
#### See also:
* `\Promise`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `fromSupergroup(int $id): float|int`
Convert bot API channel ID to MTProto channel ID.
Parameters:
* `$id`: `int` Bot API channel ID
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `fullChatLastUpdated(mixed $id): \Amp\Promise<int>`
When were full info for this chat last cached.
Parameters:
* `$id`: `mixed` Chat ID
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `fullGetSelf(): \Amp\Promise<array|bool>`
Get info about the logged-in user, not cached.
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `genVectorHash(array $ints): \int Vector hash`
Generate MTProto vector hash.
Parameters:
* `$ints`: `array` IDs
Return value: Vector hash
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getAllMethods(): mixed`
Get full list of MTProto and API methods.
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getAuthorization(): mixed`
Get authorization info.
Fully typed return value:
```
int|\Amp\Promise<int>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getCachedConfig(): mixed`
Get cached server-side config.
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getCall(int $call): mixed`
Get call info.
Parameters:
* `$call`: `int` Call ID
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getCdnConfig(string $datacenter): \Amp\Promise`
Store RSA keys for CDN datacenters.
Parameters:
* `$datacenter`: `string` DC ID
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getConfig(array $config, array $options): \Amp\Promise`
Get cached (or eventually re-fetch) server-side config.
Parameters:
* `$config`: `array` Current config
* `$options`: `array` Options for method call
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getDNSClient(): mixed`
Get async DNS client.
Fully typed return value:
```
\Amp\Dns\Resolver|\Amp\Promise<\Amp\Dns\Resolver>
```
#### See also:
* `\Amp\Dns\Resolver`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getDataCenterConnections(): mixed`
Get all datacenter connections.
Fully typed return value:
```
array<\danog\MadelineProto\DataCenterConnection>|\Amp\Promise<array<\danog\MadelineProto\DataCenterConnection>>
```
#### See also:
* [`\danog\MadelineProto\DataCenterConnection`: Datacenter connection.](./DataCenterConnection.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getDataCenterId(): int|string`
Get main DC ID.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getDialogs(bool $force): \Amp\Promise`
Get dialog peers.
Parameters:
* `$force`: `bool` Whether to refetch all dialogs ignoring cache
Fully typed return value:
```
\Amp\Promise<list<mixed>>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getDownloadInfo(mixed $messageMedia): \Amp\Promise<array>`
Get download info of file
Returns an array with the following structure:.
`$info['ext']` - The file extension
`$info['name']` - The file name, without the extension
`$info['mime']` - The file mime type
`$info['size']` - The file size
Parameters:
* `$messageMedia`: `mixed` File ID
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getEventHandler(): mixed`
Get event handler.
Fully typed return value:
```
\danog\MadelineProto\EventHandler|\Amp\Promise<\danog\MadelineProto\EventHandler>
```
#### See also:
* [`\danog\MadelineProto\EventHandler`: Event handler.](./EventHandler.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getExtensionFromLocation(mixed $location, string $default): string`
Get extension from file location.
Parameters:
* `$location`: `mixed` File location
* `$default`: `string` Default extension
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getExtensionFromMime(string $mime): string`
Get extension from mime type.
Parameters:
* `$mime`: `string` MIME type
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getFileInfo(mixed $constructor): \Amp\Promise<array>`
Get info about file.
Parameters:
* `$constructor`: `mixed` File ID
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getFolderId(mixed $id): ?int`
Get folder ID from object.
Parameters:
* `$id`: `mixed` Object
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getFullDialogs(bool $force): \Amp\Promise`
Get full info of all dialogs.
Parameters:
* `$force`: `bool` Whether to refetch all dialogs ignoring cache
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getFullInfo(mixed $id): \Amp\Promise FullInfo object`
Get full info about peer, returns an FullInfo object.
Parameters:
* `$id`: `mixed` Peer
Return value: FullInfo object
Fully typed return value:
```
\Amp\Promise<array>
```
#### See also:
* [https://docs.madelineproto.xyz/FullInfo.html](https://docs.madelineproto.xyz/FullInfo.html)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getHTTPClient(): mixed`
Get async HTTP client.
Fully typed return value:
```
\Amp\Http\Client\HttpClient|\Amp\Promise<\Amp\Http\Client\HttpClient>
```
#### See also:
* `\Amp\Http\Client\HttpClient`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getHint(): mixed`
Get current password hint.
Fully typed return value:
```
string|\Amp\Promise<string>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getId(mixed $id): int`
Get bot API ID from peer object.
Parameters:
* `$id`: `mixed` Peer
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getInfo(mixed $id, bool $recursive): \Amp\Promise 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`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getLogger()`
Get logger.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getMethodNamespaces(): mixed`
Get TL namespaces.
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getMethodsNamespaced(): mixed`
Get namespaced methods (method => namespace).
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getMimeFromBuffer(string $buffer): string`
Get mime type from buffer.
Parameters:
* `$buffer`: `string` Buffer
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getMimeFromExtension(string $extension, string $default): string`
Get mime type from file extension.
Parameters:
* `$extension`: `string` File extension
* `$default`: `string` Default mime type
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getMimeFromFile(string $file): string`
Get mime type of file.
Parameters:
* `$file`: `string` File
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getPropicInfo(mixed $messageMedia): \Amp\Promise<array>`
Get download info of the propic of a user
Returns an array with the following structure:.
`$info['ext']` - The file extension
`$info['name']` - The file name, without the extension
`$info['mime']` - The file mime type
`$info['size']` - The file size
Parameters:
* `$messageMedia`: `mixed` File ID
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getPsrLogger()`
Get PSR logger.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getPwrChat(mixed $id): \Amp\Promise<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)
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getSecretChat(array|int $chat): mixed`
Get secret chat.
Parameters:
* `$chat`: `array|int` Secret chat ID
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getSelf(): array|bool`
Get info about the logged-in user, cached.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getSettings(): mixed`
Return current settings.
Fully typed return value:
```
\danog\MadelineProto\Settings|\Amp\Promise<\danog\MadelineProto\Settings>
```
#### See also:
* [`\danog\MadelineProto\Settings`: Settings class used for configuring MadelineProto.](./Settings.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getTL(): mixed`
Get TL serializer.
Fully typed return value:
```
\danog\MadelineProto\TL\TL|\Amp\Promise<\danog\MadelineProto\TL\TL>
```
#### See also:
* [`\danog\MadelineProto\TL\TL`: TL serialization.](./TL/TL.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getVar(object $obj, string $var): mixed`
Accesses a private variable from an object.
Parameters:
* `$obj`: `object` Object
* `$var`: `string` Attribute name
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getWebTemplate(): mixed`
Get web template.
Fully typed return value:
```
string|\Amp\Promise<string>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `hasAllAuth(): mixed`
Checks whether all datacenters are authorized.
Fully typed return value:
```
bool|\Amp\Promise<bool>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `hasEventHandler(): mixed`
Check if an event handler instance is present.
Fully typed return value:
```
bool|\Amp\Promise<bool>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `hasReportPeers(): mixed`
Check if has report peers.
Fully typed return value:
```
bool|\Amp\Promise<bool>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `hasSecretChat(array|int $chat): mixed`
Check whether secret chat exists.
Parameters:
* `$chat`: `array|int` Secret chat ID
Fully typed return value:
```
bool|\Amp\Promise<bool>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `hasVar(object $obj, string $var): bool`
Checks private property exists in an object.
Parameters:
* `$obj`: `object` Object
* `$var`: `string` Attribute name
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `importAuthorization(mixed $authorization): \Amp\Promise`
Import authorization.
Parameters:
* `$authorization`: `mixed` Authorization info
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `inflateStripped(string $stripped): \string JPG payload`
Inflate stripped photosize to full JPG payload.
Parameters:
* `$stripped`: `string` Stripped photosize
Return value: JPG payload
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `initSelfRestart(): mixed`
Initialize self-restart hack.
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `isAltervista(): bool`
Whether this is altervista.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `isArrayOrAlike(mixed $var): bool`
Check if is array or similar (traversable && countable && arrayAccess).
Parameters:
* `$var`: `mixed` Value to check
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `isIpc(): mixed`
Whether we're an IPC client instance.
Fully typed return value:
```
bool|\Amp\Promise<bool>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `isSupergroup(int $id): bool`
Check whether provided bot API ID is a channel.
Parameters:
* `$id`: `int` Bot API ID
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `logger(string $param, int $level, string $file): mixed`
Logger.
Parameters:
* `$param`: `string` Parameter
* `$level`: `int` Logging level
* `$file`: `string` File where the message originated
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `logout(): \Amp\Promise`
Log out currently logged in user.
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `loop(callable|null $callback): \Amp\Promise`
Start MadelineProto's update handling loop, or run the provided async callable.
Parameters:
* `$callback`: `callable|null` Async callable to run
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `loopFork(): \Amp\Promise`
Start MadelineProto's update handling loop in background.
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `markdownEscape(string $hwat): string`
Escape string for markdown.
Parameters:
* `$hwat`: `string` String to escape
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `mbStrSplit(string $text, int $length): array`
Telegram UTF-8 multibyte split.
Parameters:
* `$text`: `string` Text
* `$length`: `int` Length
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `mbStrlen(string $text): float|int`
Get Telegram UTF-8 length of string.
Parameters:
* `$text`: `string` Text
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `mbSubstr(string $text, int $offset, ?int $length): string`
Telegram UTF-8 multibyte substring.
Parameters:
* `$text`: `string` Text to substring
* `$offset`: `int` Offset
* `$length`: `?int` Length
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `methodCall(string $method, array|\Generator $args, array $aargs): \Amp\Promise`
Call method and wait asynchronously for response.
If the $aargs['noResponse'] is true, will not wait for a response.
Parameters:
* `$method`: `string` Method name
* `$args`: `array|\Generator` Arguments
Full type:
```
array|\Generator<mixed, mixed, mixed, array>
```
* `$aargs`: `array` Additional arguments
#### See also:
* `\Generator`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `methodCallWrite(string $method, array|\Generator $args, array $aargs): \Amp\Promise`
Call method and make sure it is asynchronously sent.
Parameters:
* `$method`: `string` Method name
* `$args`: `array|\Generator` Arguments
Full type:
```
array|\Generator<mixed, mixed, mixed, array>
```
* `$aargs`: `array` Additional arguments
#### See also:
* `\Generator`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `methodEscape(string $method): string`
Escape method name.
Parameters:
* `$method`: `string` Method name
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `packDouble(float $value): string`
Convert double to binary version.
Parameters:
* `$value`: `float` Value to convert
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `packSignedInt(int $value): string`
Convert integer to base256 signed int.
Parameters:
* `$value`: `int` Value to convert
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `packSignedLong(int $value): string`
Convert integer to base256 long.
Parameters:
* `$value`: `int` Value to convert
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `packUnsignedInt(int $value): string`
Convert value to unsigned base256 int.
Parameters:
* `$value`: `int` Value
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `peerIsset(mixed $id): \Amp\Promise`
Check if peer is present in internal peer database.
Parameters:
* `$id`: `mixed` Peer
Fully typed return value:
```
\Amp\Promise<bool>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `phoneLogin(string $number, int $sms_type): \Amp\Promise`
Login as user.
Parameters:
* `$number`: `string` Phone number
* `$sms_type`: `int` SMS type
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `posmod(int $a, int $b): \int Modulo`
Positive modulo
Works just like the % (modulus) operator, only returns always a postive number.
Parameters:
* `$a`: `int` A
* `$b`: `int` B
Return value: Modulo
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `random(int $length): \string Random string`
Get random string of specified length.
Parameters:
* `$length`: `int` Length
Return value: Random string
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `randomInt(int $modulus): int`
Get random integer.
Parameters:
* `$modulus`: `int` Modulus
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `readLine(string $prompt): \Amp\Promise<string>`
Asynchronously read line.
Parameters:
* `$prompt`: `string` Prompt
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `rekey(int $chat): \Amp\Promise`
Rekey secret chat.
Parameters:
* `$chat`: `int` Secret chat to rekey
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `report(string $message, string $parseMode): \Amp\Promise`
Report an error to the previously set peer.
Parameters:
* `$message`: `string` Error to report
* `$parseMode`: `string` Parse mode
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `requestCall(mixed $user): \Amp\Promise`
Request VoIP call.
Parameters:
* `$user`: `mixed` User
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `requestSecretChat(mixed $user): \Amp\Promise`
Request secret chat.
Parameters:
* `$user`: `mixed` User to start secret chat with
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `resetUpdateState(): mixed`
Reset the update state and fetch all updates from the beginning.
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `resolveUsername(string $username): \Amp\Promise`
Resolve username (use getInfo instead).
Parameters:
* `$username`: `string` Username
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `restart(): void`
Restart update loop.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `rethrow(\Throwable $e, string $file): void`
Rethrow error catched in strand.
Parameters:
* `$e`: `\Throwable` Exception
* `$file`: `string` File where the strand started
#### See also:
* `\Throwable`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `rleDecode(string $string): string`
null-byte RLE decode.
Parameters:
* `$string`: `string` Data to decode
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `rleEncode(string $string): string`
null-byte RLE encode.
Parameters:
* `$string`: `string` Data to encode
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `secretChatStatus(int $chat): mixed`
Get secret chat status.
Parameters:
* `$chat`: `int` Chat ID
Fully typed return value:
```
int|\Amp\Promise<int>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `serializeAll(): void`
Serialize all instances.
CALLED ONLY ON SHUTDOWN.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setCallback(callable $callback): mixed`
Set update handling callback.
Parameters:
* `$callback`: `callable` Callback
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setEventHandler(class-string<\danog\MadelineProto\EventHandler> $eventHandler): \Amp\Promise`
Set event handler.
Parameters:
* `$eventHandler`: `class-string<\danog\MadelineProto\EventHandler>` Event handler
#### See also:
* [`\danog\MadelineProto\EventHandler`: Event handler.](./EventHandler.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setNoop(): mixed`
Set NOOP update handler, ignoring all updates.
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setReportPeers(int|string $userOrId): \Amp\Promise`
Set peer(s) where to send errors occurred in the event loop.
Parameters:
* `$userOrId`: `int|string` Username(s) or peer ID(s)
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setVar(object $obj, string $var, mixed $val): void`
Sets a private variable in an object.
Parameters:
* `$obj`: `object` Object
* `$var`: `string` Attribute name
* `$val`: `mixed` Attribute value
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setWebTemplate(string $template): mixed`
Set web template.
Parameters:
* `$template`: `string` Template
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setWebhook(string $hook_url, string $pem_path): mixed`
Set webhook update handler.
Parameters:
* `$hook_url`: `string` Webhook URL
* `$pem_path`: `string` PEM path for self-signed certificate
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setupLogger(): mixed`
Setup logger.
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `sleep(int|float $time): \Amp\Promise`
Asynchronously sleep.
Parameters:
* `$time`: `int|float` Number of seconds to sleep for
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `some((\Promise|\Generator)[] $promises): \Amp\Promise`
Resolves with a two-item array delineating successful and failed Promise results.
The returned promise will only fail if the given number of required promises fail.
Parameters:
* `$promises`: `(\Promise|\Generator)[]` Promises
#### See also:
* `\Promise`
* `\Generator`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `start(): \Amp\Promise`
Log in to telegram (via CLI or web).
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `stop(): void`
Stop update loop.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `tdToMTProto(array $params): \Amp\Promise<array>`
Convert TD to MTProto parameters.
Parameters:
* `$params`: `array` Parameters
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `tdToTdcli(mixed $params): mixed`
Convert TD parameters to tdcli.
Parameters:
* `$params`: `mixed` Parameters
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `tdcliToTd(array $params, array $key): mixed`
Convert tdcli parameters to tdcli.
Parameters:
* `$params`: `array` Params
* `$key`: `array` Key
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `timeout(\Generator|\Promise $promise, int $timeout): \Amp\Promise`
Create an artificial timeout for any \Generator or Promise.
Parameters:
* `$promise`: `\Generator|\Promise`
* `$timeout`: `int`
#### See also:
* `\Generator`
* `\Promise`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `timeoutWithDefault(\Promise|\Generator $promise, int $timeout, mixed $default): \Amp\Promise<\TReturn>|\Promise<\TReturnAlt>`
Creates an artificial timeout for any `Promise`.
If the promise is resolved before the timeout expires, the result is returned
If the timeout expires before the promise is resolved, a default value is returned
Parameters:
* `$promise`: `\Promise|\Generator` Promise to which the timeout is applied.
Full type:
```
\Promise<\TReturn>|\TGenerator
```
* `$timeout`: `int` Timeout in milliseconds.
* `$default`: `mixed`
Full type:
```
\TReturnAlt
```
#### See also:
* `\Promise`
* `\Generator`
* `\TReturn`
* `\TGenerator`
* `\TReturnAlt`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `toCamelCase(string $input): string`
Convert to camelCase.
Parameters:
* `$input`: `string` String
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `toSnakeCase(string $input): string`
Convert to snake_case.
Parameters:
* `$input`: `string` String
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `toSupergroup(int $id): float|int`
Convert MTProto channel ID to bot API channel ID.
Parameters:
* `$id`: `int` MTProto channel ID
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `typeEscape(string $type): string`
Escape type name.
Parameters:
* `$type`: `string` String to escape
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `unpackDouble(string $value): float`
Unpack binary double.
Parameters:
* `$value`: `string` Value to unpack
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `unpackFileId(string $fileId): mixed`
Unpack bot API file ID.
Parameters:
* `$fileId`: `string` Bot API file ID
Fully typed return value:
```
array|\Amp\Promise<array>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `unpackSignedInt(string $value): int`
Unpack base256 signed int.
Parameters:
* `$value`: `string` base256 int
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `unpackSignedLong(string $value): int`
Unpack base256 signed long.
Parameters:
* `$value`: `string` base256 long
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `unpackSignedLongString(string $value): string`
Unpack base256 signed long to string.
Parameters:
* `$value`: `string` base256 long
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `unsetEventHandler(bool $disableUpdateHandling): mixed`
Unset event handler.
Parameters:
* `$disableUpdateHandling`: `bool` Whether to also disable internal update handling (will cause errors, otherwise will simply use the NOOP handler)
Fully typed return value:
```
void|\Amp\Promise<void>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `update2fa(array $params): \Amp\Promise`
Update the 2FA password.
The params array can contain password, new_password, email and hint params.
Parameters:
* `$params`: `array` The params
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `updateSettings(\danog\MadelineProto\SettingsAbstract $settings): \Amp\Promise`
Parse, update and store settings.
Parameters:
* `$settings`: `\danog\MadelineProto\SettingsAbstract` Settings
#### See also:
* `\danog\MadelineProto\SettingsAbstract`
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `upload(\danog\MadelineProto\FileCallbackInterface|string|array $file, string $fileName, callable $cb, bool $encrypted): \Amp\Promise`
Upload file.
Parameters:
* `$file`: `\danog\MadelineProto\FileCallbackInterface|string|array` File, URL or Telegram file to upload
* `$fileName`: `string` File name
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
* `$encrypted`: `bool` Whether to encrypt file for secret chats
Fully typed return value:
```
\Amp\Promise<mixed>
```
#### See also:
* [`\danog\MadelineProto\FileCallbackInterface`: File callback interface.](./FileCallbackInterface.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `uploadEncrypted(\danog\MadelineProto\FileCallbackInterface|string|array $file, string $fileName, callable $cb): \Amp\Promise`
Upload file to secret chat.
Parameters:
* `$file`: `\danog\MadelineProto\FileCallbackInterface|string|array` File, URL or Telegram file to upload
* `$fileName`: `string` File name
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
Fully typed return value:
```
\Amp\Promise<mixed>
```
#### See also:
* [`\danog\MadelineProto\FileCallbackInterface`: File callback interface.](./FileCallbackInterface.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `uploadFromCallable(mixed $callable, int $size, string $mime, string $fileName, callable $cb, bool $seekable, bool $encrypted): \Amp\Promise`
Upload file from callable.
The callable must accept two parameters: int $offset, int $size
The callable must return a string with the contest of the file at the specified offset and size.
Parameters:
* `$callable`: `mixed` Callable
* `$size`: `int` File size
* `$mime`: `string` Mime type
* `$fileName`: `string` File name
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
* `$seekable`: `bool` Whether chunks can be fetched out of order
* `$encrypted`: `bool` Whether to encrypt file for secret chats
Fully typed return value:
```
\Amp\Promise<array{_: string, id: string, parts: int, name: string, mime_type: string, key_fingerprint?: mixed, key?: mixed, iv?: mixed, md5_checksum: string}>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `uploadFromStream(mixed $stream, int $size, string $mime, string $fileName, callable $cb, bool $encrypted): \Amp\Promise`
Upload file from stream.
Parameters:
* `$stream`: `mixed` PHP resource or AMPHP async stream
* `$size`: `int` File size
* `$mime`: `string` Mime type
* `$fileName`: `string` File name
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
* `$encrypted`: `bool` Whether to encrypt file for secret chats
Fully typed return value:
```
\Amp\Promise<mixed>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `uploadFromTgfile(mixed $media, callable $cb, bool $encrypted): \Amp\Promise`
Reupload telegram file.
Parameters:
* `$media`: `mixed` Telegram file
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
* `$encrypted`: `bool` Whether to encrypt file for secret chats
Fully typed return value:
```
\Amp\Promise<mixed>
```
#### See also:
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `uploadFromUrl(string|\danog\MadelineProto\FileCallbackInterface $url, int $size, string $fileName, callable $cb, bool $encrypted): \Amp\Promise`
Upload file from URL.
Parameters:
* `$url`: `string|\danog\MadelineProto\FileCallbackInterface` URL of file
* `$size`: `int` Size of file
* `$fileName`: `string` File name
* `$cb`: `callable` Callback (DEPRECATED, use FileCallbackInterface)
* `$encrypted`: `bool` Whether to encrypt file for secret chats
Fully typed return value:
```
\Amp\Promise<mixed>
```
#### See also:
* [`\danog\MadelineProto\FileCallbackInterface`: File callback interface.](./FileCallbackInterface.md)
* `\Amp\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `wait(\Generator|\Promise $promise, bool $ignoreSignal): mixed`
Synchronously wait for a promise|generator.
Parameters:
* `$promise`: `\Generator|\Promise` The promise to wait for
* `$ignoreSignal`: `bool` Whether to ignore shutdown signals
#### See also:
* `\Generator`
* `\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `async(bool $async): void`
Enable or disable async.
Parameters:
* `$async`: `bool` Whether to enable or disable async
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `init(): void`
Blockingly init.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `initAsynchronously(): \Generator`
Asynchronously init.
#### See also:
* `\Generator`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `inited(): bool`
Check if we've already inited.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `forceInit(bool $inited): void`
Mark instance as (de)inited forcefully.
Parameters:
* `$inited`: `bool` Whether to mark the instance as inited or deinited
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getWebAPITemplate(): string`
Get web API login HTML template string.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setWebAPITemplate(): void`
Set web API login HTML template string.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)