Docufix, changed deserialization API, added php 7 check

This commit is contained in:
Daniil Gentili 2017-11-03 15:02:01 +03:00
parent c668f5933f
commit e5da891ac2
2428 changed files with 383 additions and 20814 deletions

162
README.md
View File

@ -155,31 +155,18 @@ You can find examples for nearly every MadelineProto function in
VERY IMPORTANT: An istance of MadelineProto MUST be serialized every time an update is fetched, and on shutdown. To serialize MadelineProto to a file, you must use the `\danog\MadelineProto\Serialization` class:
```
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline');
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
// Do stuff
\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto);
// or
$MadelineProto->serialize('session.madeline');
```
Or, to serialize automatically every time and update is fetched and on shutdown:
```
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline');
$MadelineProto->session = 'session.madeline';
```
This way, if the scripts shutsdown normally (without ctrl+c or fatal errors/exceptions), the session will also be serialized automatically.
It is still recommended to serialize the session at every update.
The deserialize method accepts a second optional parameter, `$no_updates`, that can be set to true to avoid fetching updates on deserialization, and postpone parsing of updates received through the socket until the next deserialization.
That class serializes using [MagicalSerializer](https://github.com/danog/MagicalSerializer).
The same should be done when serializing to another destination manually, to avoid conflicts with other PHP scripts that are trying to serialize another instance of the class.
## Methods
A list of all of the methods that can be called with MadelineProto can be found here: [here (layer 71)](https://daniil.it/MadelineProto/API_docs/).
@ -296,7 +283,148 @@ If you're selling a MadelineProto base too, you really should consider donating
### Settings
The constructor accepts an optional parameter, which is the settings array. This array contains some other arrays, which are the settings for a specific MadelineProto function.
See [here](https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProto.php#L448) for the default values for the settings arrays and explanations for every setting.
Here are the default values for the settings arrays and explanations for every setting:
```
[
'authorization' => [ // Authorization settings
'default_temp_auth_key_expires_in' => 31557600, // validity of temporary keys and the binding of the temporary and permanent keys
'rsa_keys' => [
"-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6\nlyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS\nan9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw\nEfzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+\n8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n\nSlv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB\n-----END RSA PUBLIC KEY-----",
"-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAxq7aeLAqJR20tkQQMfRn+ocfrtMlJsQ2Uksfs7Xcoo77jAid0bRt\nksiVmT2HEIJUlRxfABoPBV8wY9zRTUMaMA654pUX41mhyVN+XoerGxFvrs9dF1Ru\nvCHbI02dM2ppPvyytvvMoefRoL5BTcpAihFgm5xCaakgsJ/tH5oVl74CdhQw8J5L\nxI/K++KJBUyZ26Uba1632cOiq05JBUW0Z2vWIOk4BLysk7+U9z+SxynKiZR3/xdi\nXvFKk01R3BHV+GUKM2RYazpS/P8v7eyKhAbKxOdRcFpHLlVwfjyM1VlDQrEZxsMp\nNTLYXb6Sce1Uov0YtNx5wEowlREH1WOTlwIDAQAB\n-----END RSA PUBLIC KEY-----",
"-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAsQZnSWVZNfClk29RcDTJQ76n8zZaiTGuUsi8sUhW8AS4PSbPKDm+\nDyJgdHDWdIF3HBzl7DHeFrILuqTs0vfS7Pa2NW8nUBwiaYQmPtwEa4n7bTmBVGsB\n1700/tz8wQWOLUlL2nMv+BPlDhxq4kmJCyJfgrIrHlX8sGPcPA4Y6Rwo0MSqYn3s\ng1Pu5gOKlaT9HKmE6wn5Sut6IiBjWozrRQ6n5h2RXNtO7O2qCDqjgB2vBxhV7B+z\nhRbLbCmW0tYMDsvPpX5M8fsO05svN+lKtCAuz1leFns8piZpptpSCFn7bWxiA9/f\nx5x17D7pfah3Sy2pA+NDXyzSlGcKdaUmwQIDAQAB\n-----END RSA PUBLIC KEY-----",
"-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAwqjFW0pi4reKGbkc9pK83Eunwj/k0G8ZTioMMPbZmW99GivMibwa\nxDM9RDWabEMyUtGoQC2ZcDeLWRK3W8jMP6dnEKAlvLkDLfC4fXYHzFO5KHEqF06i\nqAqBdmI1iBGdQv/OQCBcbXIWCGDY2AsiqLhlGQfPOI7/vvKc188rTriocgUtoTUc\n/n/sIUzkgwTqRyvWYynWARWzQg0I9olLBBC2q5RQJJlnYXZwyTL3y9tdb7zOHkks\nWV9IMQmZmyZh/N7sMbGWQpt4NMchGpPGeJ2e5gHBjDnlIf2p1yZOYeUYrdbwcS0t\nUiggS4UeE8TzIuXFQxw7fzEIlmhIaq3FnwIDAQAB\n-----END RSA PUBLIC KEY-----",
], // RSA public keys
],
'connection' => [ // List of datacenters/subdomains where to connect
'ssl_subdomains' => [ // Subdomains of web.telegram.org for https protocol
1 => 'pluto',
2 => 'venus',
3 => 'aurora',
4 => 'vesta',
5 => 'flora', // musa oh wait no :(
],
'test' => [ // Test datacenters
'ipv4' => [ // ipv4 addresses
2 => [ // The rest will be fetched automatically
'ip_address' => '149.154.167.40',
'port' => 443,
'media_only' => false,
'tcpo_only' => false,
],
],
'ipv6' => [ // ipv6 addresses
2 => [ // The rest will be fetched automatically
'ip_address' => '2001:067c:04e8:f002:0000:0000:0000:000e',
'port' => 443,
'media_only' => false,
'tcpo_only' => false,
],
],
],
'main' => [ // Main datacenters
'ipv4' => [ // ipv4 addresses
2 => [ // The rest will be fetched automatically
'ip_address' => '149.154.167.51',
'port' => 443,
'media_only' => false,
'tcpo_only' => false,
],
],
'ipv6' => [ // ipv6 addresses
2 => [ // The rest will be fetched automatically
'ip_address' => '2001:067c:04e8:f002:0000:0000:0000:000a',
'port' => 443,
'media_only' => false,
'tcpo_only' => false,
],
],
],
],
'connection_settings' => [ // connection settings
'all' => [ // These settings will be applied on every datacenter that hasn't a custom settings subarray...
'protocol' => 'tcp_full', // can be tcp_full, tcp_abridged, tcp_intermediate, http, https, obfuscated2, udp (unsupported)
'test_mode' => false, // decides whether to connect to the main telegram servers or to the testing servers (deep telegram)
'ipv6' => $this - > ipv6, // decides whether to use ipv6, ipv6 attribute of API attribute of API class contains autodetected boolean
'timeout' => 2, // timeout for sockets
'proxy' => '\Socket', // The proxy class to use
'proxy_extra' => [], // Extra parameters to pass to the proxy class using setExtra
],
],
'app_info' => [ // obtained in https://my.telegram.org
//'api_id' => you should put an API id in the settings array you provide
//'api_hash' => you should put an API hash in the settings array you provide
'device_model' => $device_model,
'system_version' => $system_version,
'app_version' => 'Unicorn',
'lang_code' => $lang_code,
],
'tl_schema' => [ // TL scheme files
'layer' => 72, // layer version
'src' => [
'mtproto' => __DIR__.'/TL_mtproto_v1.json', // mtproto TL scheme
'telegram' => __DIR__.'/TL_telegram_v72.tl', // telegram TL scheme
'secret' => __DIR__.'/TL_secret.tl', // secret chats TL scheme
'calls' => __DIR__.'/TL_calls.tl', // calls TL scheme
'botAPI' => __DIR__.'/TL_botAPI.tl', // bot API TL scheme for file ids
],
],
'logger' => [ // Logger settings
/*
* logger modes:
* 0 - No logger
* 1 - Log to the default logger destination
* 2 - Log to file defined in second parameter
* 3 - Echo logs
* 4 - Call callable provided in logger_param. logger_param must accept two parameters: array $message, int $level
* $message is an array containing the messages the log, $level, is the logging level
*/
'logger' => 1, // write to
'logger_param' => '/tmp/MadelineProto.log',
'logger' => 3, // overwrite previous setting and echo logs
'logger_level' => Logger::VERBOSE, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function.
'rollbar_token' => 'f9fff6689aea4905b58eec73f66c791d' // You can provide a token for the rollbar log management system
],
'max_tries' => [
'query' => 5, // How many times should I try to call a method or send an object before throwing an exception
'authorization' => 5, // How many times should I try to generate an authorization key before throwing an exception
'response' => 5, // How many times should I try to get a response of a query before throwing an exception
],
'flood_timeout' => [
'wait_if_lt' => 20, // Sleeps if flood block time is lower than this
],
'msg_array_limit' => [ // How big should be the arrays containing the incoming and outgoing messages?
'incoming' => 200,
'outgoing' => 200,
'call_queue' => 200,
],
'peer' => [
'full_info_cache_time' => 60,
],
'requests' => [
'gzip_encode_if_gt' => 500, // Should I try using gzip encoding for requests bigger than N bytes? Set to -1 to disable.
],
'updates' => [
'handle_updates' => true, // Should I handle updates?
'callback' => 'get_updates_update_handler', // A callable function that will be called every time an update is received, must accept an array (for the update) as the only parameter
],
'secret_chats' => [
'accept_chats' => true, // Should I accept secret chats? Can be true, false or on array of user ids from which to accept chats
],
'threading' => [
'allow_threading' => false, // Should I use threading, if it is enabled?
'handler_workers' => 10, // How many workers should every message handler pool of each socket reader have
],
'pwr' => [
'pwr' => false, // Need info ?
'db_token' => false, // Need info ?
'strict' => false, // Need info ?
'requests' => true, // Should I get info about unknown peers from PWRTelegram?
],
];
```
You can provide part of any subsetting array, that way the remaining arrays will be automagically set to default and undefined values of specified subsetting arrays will be set to the default values.
Example:
@ -326,8 +454,10 @@ Note that only settings arrays or values of a settings array will be set to defa
The settings array can be accessed and modified in the instantiated class by accessing the `settings` attribute of the API class:
```
$MadelineProto = new \danog\MadelineProto\API();
$yoursettings = ['updates' => ['handle_updates' => false]]; // disable update handlig
$MadelineProto = new \danog\MadelineProto\API($yoursettings);
var_dump($MadelineProto->settings);
$MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching
```
### Handling updates

View File

@ -16,7 +16,7 @@ require 'vendor/autoload.php';
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
try {
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('bot.madeline');
$MadelineProto = new \danog\MadelineProto\API('bot.madeline');
} catch (\danog\MadelineProto\Exception $e) {
var_dump($e->getMessage());
$MadelineProto = new \danog\MadelineProto\API($settings);

View File

@ -20,13 +20,6 @@ description: account.changePhone parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PHONE_NUMBER_INVALID|The phone number is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: account.checkUsername parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|USERNAME_INVALID|The provided username is not valid|
### Example:

View File

@ -19,14 +19,6 @@ description: account.confirmPhone parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CODE_HASH_INVALID|Code hash invalid|
|PHONE_CODE_EMPTY|phone_code is missing|
### Example:

View File

@ -18,13 +18,6 @@ description: account.getNotifySettings parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: account.getPasswordSettings parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PASSWORD_HASH_INVALID|The provided password hash is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: account.getPrivacy parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PRIVACY_KEY_INVALID|The privacy key is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: account.getTmpPassword parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|TMP_PASSWORD_DISABLED|The temporary password is disabled|
### Example:

View File

@ -19,13 +19,6 @@ description: account.registerDevice parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|TOKEN_INVALID|The provided token is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: account.reportPeer parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: account.resetAuthorization parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|HASH_INVALID|The provided hash is invalid|
### Example:

View File

@ -20,13 +20,6 @@ description: account.sendChangePhoneCode parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PHONE_NUMBER_INVALID|The phone number is invalid|
### Example:

View File

@ -20,13 +20,6 @@ description: account.sendConfirmPhoneCode parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|HASH_INVALID|The provided hash is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: account.setAccountTTL parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|TTL_DAYS_INVALID|The provided TTL is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: account.setPrivacy parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PRIVACY_KEY_INVALID|The privacy key is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: account.unregisterDevice parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|TOKEN_INVALID|The provided token is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: account.updateNotifySettings parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -19,15 +19,6 @@ description: account.updatePasswordSettings parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|NEW_SALT_INVALID|The new salt is invalid|
|NEW_SETTINGS_INVALID|The new settings are invalid|
|PASSWORD_HASH_INVALID|The provided password hash is invalid|
### Example:

View File

@ -20,14 +20,6 @@ description: account.updateProfile parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|ABOUT_TOO_LONG|The provided bio is too long|
|FIRSTNAME_INVALID|The first name is invalid|
### Example:

View File

@ -18,15 +18,6 @@ description: account.updateUsername parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|USERNAME_INVALID|The provided username is not valid|
|USERNAME_NOT_MODIFIED|The username was not modified|
|USERNAME_OCCUPIED|The provided username is already occupied|
### Example:

View File

@ -21,15 +21,6 @@ description: auth.bindTempAuthKey parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|ENCRYPTED_MESSAGE_INVALID|Encrypted message invalid|
|INPUT_REQUEST_TOO_LONG|The request is too big|
|TEMP_AUTH_KEY_EMPTY|No temporary auth key provided|
### Example:

View File

@ -19,13 +19,6 @@ description: auth.cancelCode parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PHONE_NUMBER_INVALID|The phone number is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: auth.checkPassword parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PASSWORD_HASH_INVALID|The provided password hash is invalid|
### Example:

View File

@ -18,15 +18,6 @@ description: auth.checkPhone parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PHONE_NUMBER_BANNED|The provided phone number is banned from telegram|
|PHONE_NUMBER_INVALID|The phone number is invalid|
|PHONE_NUMBER_INVALID|The phone number is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: auth.exportAuthorization parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|DC_ID_INVALID|The provided DC ID is invalid|
### Example:

View File

@ -19,14 +19,6 @@ description: auth.importAuthorization parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|AUTH_BYTES_INVALID|The provided authorization is invalid|
|USER_ID_INVALID|The provided user ID is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: auth.recoverPassword parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CODE_EMPTY|The provided code is empty|
### Example:

View File

@ -13,13 +13,6 @@ description: auth.requestPasswordRecovery parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PASSWORD_EMPTY|The provided password is empty|
### Example:

View File

@ -19,13 +19,6 @@ description: auth.resendCode parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PHONE_NUMBER_INVALID|The phone number is invalid|
### Example:

View File

@ -13,13 +13,6 @@ description: auth.resetAuthorizations parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|Timeout|A timeout occurred while fetching data from the bot|
### Example:

View File

@ -19,13 +19,6 @@ description: auth.sendInvites parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|MESSAGE_EMPTY|The provided message is empty|
### Example:

View File

@ -19,14 +19,6 @@ description: bots.answerWebhookJSONQuery parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|QUERY_ID_INVALID|The query ID is invalid|
|USER_BOT_INVALID|This method can only be called by a bot|
### Example:

View File

@ -19,13 +19,6 @@ description: bots.sendCustomRequest parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|USER_BOT_INVALID|This method can only be called by a bot|
### Example:

View File

@ -19,15 +19,6 @@ description: channels.checkUsername parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ID_INVALID|The provided chat id is invalid|
|USERNAME_INVALID|The provided username is not valid|
### Example:

View File

@ -21,14 +21,6 @@ description: channels.createChannel parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_TITLE_EMPTY|No chat title provided|
|USER_RESTRICTED|You're spamreported, you can't create channels or chats.|
### Example:

View File

@ -18,14 +18,6 @@ description: channels.deleteChannel parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
### Example:

View File

@ -19,15 +19,6 @@ description: channels.deleteMessages parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|MESSAGE_DELETE_FORBIDDEN|You can't delete one of the messages you tried to delete, most likely because it is a service message.|
### Example:

View File

@ -19,14 +19,6 @@ description: channels.deleteUserHistory parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
### Example:

View File

@ -19,15 +19,6 @@ description: channels.editAbout parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ABOUT_NOT_MODIFIED|About text has not changed|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
### Example:

View File

@ -20,20 +20,6 @@ description: channels.editAdmin parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_INVITE_REQUIRED|You do not have the rights to do this|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|RIGHT_FORBIDDEN|Your admin rights do not allow you to do this|
|USER_CREATOR|You can't leave this channel, because you're its creator|
|USER_ID_INVALID|The provided user ID is invalid|
|USER_NOT_MUTUAL_CONTACT|The provided user is not a mutual contact|
|USER_PRIVACY_RESTRICTED|The user's privacy settings do not allow you to do this|
### Example:

View File

@ -20,17 +20,6 @@ description: channels.editBanned parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|USER_ADMIN_INVALID|You're not an admin|
|USER_ID_INVALID|The provided user ID is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: channels.editPhoto parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
### Example:

View File

@ -19,15 +19,6 @@ description: channels.editTitle parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|CHAT_NOT_MODIFIED|The pinned message wasn't modified|
### Example:

View File

@ -18,15 +18,6 @@ description: channels.exportInvite parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|INVITE_HASH_EXPIRED|The invite link has expired|
### Example:

View File

@ -19,13 +19,6 @@ description: channels.exportMessageLink parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
### Example:

View File

@ -24,14 +24,6 @@ description: channels.getAdminLog parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
### Example:

View File

@ -18,15 +18,6 @@ description: channels.getChannels parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|NEED_CHAT_INVALID|The provided chat is invalid|
### Example:

View File

@ -19,14 +19,6 @@ description: channels.getMessages parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
### Example:

View File

@ -19,16 +19,6 @@ description: channels.getParticipant parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|USER_ID_INVALID|The provided user ID is invalid|
|USER_NOT_PARTICIPANT|You're not a member of this supergroup/channel|
### Example:

View File

@ -19,28 +19,6 @@ description: channels.inviteToChannel parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|BOT_GROUPS_BLOCKED|This bot can't be added to groups|
|BOTS_TOO_MUCH|There are too many bots in this chat/channel|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|INPUT_USER_DEACTIVATED|The specified user was deleted|
|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|USER_BLOCKED|User blocked|
|USER_BOT|Bots can only be admins in channels.|
|USER_CHANNELS_TOO_MUCH|One of the users you tried to add is already in too many channels/supergroups|
|USER_ID_INVALID|The provided user ID is invalid|
|USER_KICKED|This user was kicked from this supergroup/channel|
|USER_NOT_MUTUAL_CONTACT|The provided user is not a mutual contact|
|USER_PRIVACY_RESTRICTED|The user's privacy settings do not allow you to do this|
|USERS_TOO_MUCH|The maximum number of users has been exceeded (to create a chat, for example)|
### Example:

View File

@ -18,15 +18,6 @@ description: channels.joinChannel parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|CHANNELS_TOO_MUCH|You have joined too many channels/supergroups|
### Example:

View File

@ -18,16 +18,6 @@ description: channels.leaveChannel parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|USER_CREATOR|You can't leave this channel, because you're its creator|
|USER_NOT_PARTICIPANT|You're not a member of this supergroup/channel|
### Example:

View File

@ -19,13 +19,6 @@ description: channels.readHistory parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: channels.readMessageContents parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
### Example:

View File

@ -20,13 +20,6 @@ description: channels.reportSpam parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
### Example:

View File

@ -19,14 +19,6 @@ description: channels.setStickers parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|PARTICIPANTS_TOO_FEW|Not enough participants|
### Example:

View File

@ -19,14 +19,6 @@ description: channels.toggleInvites parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
### Example:

View File

@ -19,13 +19,6 @@ description: channels.toggleSignatures parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
### Example:

View File

@ -20,15 +20,6 @@ description: channels.updatePinnedMessage parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|CHAT_NOT_MODIFIED|The pinned message wasn't modified|
### Example:

View File

@ -19,16 +19,6 @@ description: channels.updateUsername parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|USERNAME_INVALID|The provided username is not valid|
|USERNAME_OCCUPIED|The provided username is already occupied|
### Example:

View File

@ -18,13 +18,6 @@ description: contacts.block parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CONTACT_ID_INVALID|The provided contact ID is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: contacts.deleteContact parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CONTACT_ID_INVALID|The provided contact ID is invalid|
### Example:

View File

@ -18,14 +18,6 @@ description: contacts.deleteContacts parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|NEED_MEMBER_INVALID|The provided member is invalid|
|Timeout|A timeout occurred while fetching data from the bot|
### Example:

View File

@ -26,13 +26,6 @@ description: contacts.getTopPeers parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|TYPES_EMPTY|The types field is empty|
### Example:

View File

@ -18,14 +18,6 @@ description: contacts.importCard parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|EXPORT_CARD_INVALID|Provided card is invalid|
|NEED_MEMBER_INVALID|The provided member is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: contacts.resetTopPeerRating parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -19,14 +19,6 @@ description: contacts.search parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|QUERY_TOO_SHORT|The query string is too short|
|SEARCH_QUERY_EMPTY|The search query is empty|
### Example:

View File

@ -18,13 +18,6 @@ description: contacts.unblock parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CONTACT_ID_INVALID|The provided contact ID is invalid|
### Example:

View File

@ -14,7 +14,7 @@ $MadelineProto->[complete_phone_login](https://docs.madelineproto.xyz/complete_p
$MadelineProto->[complete_2FA_login](https://docs.madelineproto.xyz/complete_2FA_login.html)($password);
$MadelineProto->[bot_login](https://docs.madelineproto.xyz/complete_phone_login.html)($token);
$MadelineProto->[bot_login](https://docs.madelineproto.xyz/bot_login.html)($token);
$MadelineProto->[get_dialogs](https://docs.madelineproto.xyz/get_dialogs.html)();

View File

@ -25,14 +25,6 @@ description: initConnection parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CONNECTION_LAYER_INVALID|Layer invalid|
|INPUT_FETCH_FAIL|Failed deserializing TL payload|
### Example:

View File

@ -19,16 +19,6 @@ description: invokeWithLayer parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|AUTH_BYTES_INVALID|The provided authorization is invalid|
|CDN_METHOD_INVALID|You can't call this method in a CDN DC|
|CONNECTION_API_ID_INVALID|The provided API id is invalid|
|INPUT_LAYER_INVALID|The provided layer is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: langpack.getDifference parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|LANG_PACK_INVALID|The provided language pack is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: langpack.getLangPack parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|LANG_PACK_INVALID|The provided language pack is invalid|
### Example:

View File

@ -13,13 +13,6 @@ description: langpack.getLanguages parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|LANG_PACK_INVALID|The provided language pack is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: langpack.getStrings parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|LANG_PACK_INVALID|The provided language pack is invalid|
### Example:

View File

@ -20,20 +20,6 @@ description: messages.addChatUser parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|CHAT_ID_INVALID|The provided chat id is invalid|
|PEER_ID_INVALID|The provided peer id is invalid|
|USER_ALREADY_PARTICIPANT|The user is already in the group|
|USER_ID_INVALID|The provided user ID is invalid|
|USER_NOT_MUTUAL_CONTACT|The provided user is not a mutual contact|
|USER_PRIVACY_RESTRICTED|The user's privacy settings do not allow you to do this|
|USERS_TOO_MUCH|The maximum number of users has been exceeded (to create a chat, for example)|
### Example:

View File

@ -18,15 +18,6 @@ description: messages.checkChatInvite parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|INVITE_HASH_EMPTY|The invite hash is empty|
|INVITE_HASH_EXPIRED|The invite link has expired|
|INVITE_HASH_INVALID|The invite hash is invalid|
### Example:

View File

@ -19,14 +19,6 @@ description: messages.createChat parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|USER_RESTRICTED|You're spamreported, you can't create channels or chats.|
|USERS_TOO_FEW|Not enough users (to create a chat, for example)|
### Example:

View File

@ -19,15 +19,6 @@ description: messages.deleteChatUser parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_ID_INVALID|The provided chat id is invalid|
|PEER_ID_INVALID|The provided peer id is invalid|
|USER_NOT_PARTICIPANT|You're not a member of this supergroup/channel|
### Example:

View File

@ -20,13 +20,6 @@ description: messages.deleteHistory parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: messages.deleteMessages parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|MESSAGE_DELETE_FORBIDDEN|You can't delete one of the messages you tried to delete, most likely because it is a service message.|
### Example:

View File

@ -20,13 +20,6 @@ description: messages.editChatAdmin parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_ID_INVALID|The provided chat id is invalid|
### Example:

View File

@ -19,14 +19,6 @@ description: messages.editChatPhoto parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_ID_INVALID|The provided chat id is invalid|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: messages.editChatTitle parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|NEED_CHAT_INVALID|The provided chat is invalid|
### Example:

View File

@ -23,14 +23,6 @@ description: messages.editInlineBotMessage parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|MESSAGE_ID_INVALID|The provided message id is invalid|
|MESSAGE_NOT_MODIFIED|The message text has not changed|
### Example:

View File

@ -26,20 +26,6 @@ description: messages.editMessage parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|MESSAGE_AUTHOR_REQUIRED|Message author required|
|MESSAGE_EDIT_TIME_EXPIRED|You can't edit this message anymore, too much time has passed since its creation.|
|MESSAGE_EMPTY|The provided message is empty|
|MESSAGE_ID_INVALID|The provided message id is invalid|
|MESSAGE_NOT_MODIFIED|The message text has not changed|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -18,13 +18,6 @@ description: messages.exportChatInvite parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_ID_INVALID|The provided chat id is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: messages.faveSticker parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|STICKER_ID_INVALID|The provided sticker ID is invalid|
### Example:

View File

@ -19,16 +19,6 @@ description: messages.forwardMessage parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_ID_INVALID|The provided chat id is invalid|
|MESSAGE_ID_INVALID|The provided message id is invalid|
|PEER_ID_INVALID|The provided peer id is invalid|
|YOU_BLOCKED_USER|You blocked this user|
### Example:

View File

@ -23,31 +23,6 @@ description: messages.forwardMessages parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|CHAT_ID_INVALID|The provided chat id is invalid|
|CHAT_SEND_GIFS_FORBIDDEN|You can't send gifs in this chat|
|CHAT_SEND_MEDIA_FORBIDDEN|You can't send media in this chat|
|CHAT_SEND_STICKERS_FORBIDDEN|You can't send stickers in this chat.|
|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|MEDIA_EMPTY|The provided media object is invalid|
|MESSAGE_ID_INVALID|The provided message id is invalid|
|MESSAGE_IDS_EMPTY|No message ids were provided|
|PEER_ID_INVALID|The provided peer id is invalid|
|PTS_CHANGE_EMPTY|No PTS change|
|RANDOM_ID_DUPLICATE|You provided a random ID that was already used|
|RANDOM_ID_INVALID|A provided random ID is invalid|
|Timeout|A timeout occurred while fetching data from the bot|
|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|USER_IS_BOT|Bots can't send messages to other bots|
|YOU_BLOCKED_USER|You blocked this user|
### Example:

View File

@ -21,16 +21,6 @@ description: messages.getBotCallbackAnswer parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|DATA_INVALID|Encrypted data invalid|
|MESSAGE_ID_INVALID|The provided message id is invalid|
|PEER_ID_INVALID|The provided peer id is invalid|
|Timeout|A timeout occurred while fetching data from the bot|
### Example:

View File

@ -18,14 +18,6 @@ description: messages.getChats parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|CHAT_ID_INVALID|The provided chat id is invalid|
|PEER_ID_INVALID|The provided peer id is invalid|
### Example:

View File

@ -20,13 +20,6 @@ description: messages.getCommonChats parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|USER_ID_INVALID|The provided user ID is invalid|
### Example:

View File

@ -19,13 +19,6 @@ description: messages.getDhConfig parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|RANDOM_LENGTH_INVALID|Random length invalid|
### Example:

View File

@ -22,15 +22,6 @@ description: messages.getDialogs parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|INPUT_CONSTRUCTOR_INVALID|The provided constructor is invalid|
|OFFSET_PEER_ID_INVALID|The provided offset peer is invalid|
|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|
### Example:

View File

@ -20,13 +20,6 @@ description: messages.getDocumentByHash parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|SHA256_HASH_INVALID|The provided SHA256 hash is invalid|
### Example:

View File

@ -20,14 +20,6 @@ description: messages.getGameHighScores parameters, return type and example
### Can bots use this method: **YES**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|PEER_ID_INVALID|The provided peer id is invalid|
|USER_BOT_REQUIRED|This method can only be called by a bot|
### Example:

View File

@ -24,18 +24,6 @@ description: messages.getHistory parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|
|CHANNEL_INVALID|The provided channel is invalid|
|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|CHAT_ID_INVALID|The provided chat id is invalid|
|PEER_ID_INVALID|The provided peer id is invalid|
|Timeout|A timeout occurred while fetching data from the bot|
### Example:

View File

@ -22,15 +22,6 @@ description: messages.getInlineBotResults parameters, return type and example
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|BOT_INLINE_DISABLED|This bot can't be used in inline mode|
|BOT_INVALID|This is not a valid bot|
|Timeout|A timeout occurred while fetching data from the bot|
### Example:

Some files were not shown because too many files have changed in this diff Show More