Merge commit 'd6290476'

This commit is contained in:
Daniil Gentili 2020-02-23 19:29:21 +01:00
commit e8cd2a7bb5
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
1329 changed files with 2803 additions and 162 deletions

View File

@ -49,6 +49,7 @@ User = account.changePhone({phone_number='string', phone_code_hash='string', pho
| Code | Type | Description |
|------|----------|---------------|
|400|PHONE_CODE_EMPTY|phone_code is missing|
|400|PHONE_NUMBER_INVALID|The phone number is invalid|

View File

@ -48,5 +48,6 @@ Bool = account.checkUsername({username='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|USERNAME_INVALID|The provided username is not valid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -43,3 +43,10 @@ Or, if you're into Lua:
Bool = account.finishTakeoutSession({success=Bool, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|403|TAKEOUT_REQUIRED|A takeout session has to be initialized, first|

View File

@ -38,3 +38,10 @@ Or, if you're into Lua:
account.Authorizations = account.getAuthorizations({})
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -49,3 +49,10 @@ Or, if you're into Lua:
account.Takeout = account.initTakeoutSession({contacts=Bool, message_users=Bool, message_chats=Bool, message_megagroups=Bool, message_channels=Bool, files=Bool, file_max_size=int, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|420|TAKEOUT_INIT_DELAY_X|Wait X seconds before initing takeout|

View File

@ -48,6 +48,7 @@ Bool = account.updateNotifySettings({peer=InputNotifyPeer, settings=InputPeerNot
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|SETTINGS_INVALID|Invalid settings were provided|

View File

@ -50,6 +50,7 @@ User = account.updateUsername({username='string', })
|400|USERNAME_INVALID|The provided username is not valid|
|400|USERNAME_NOT_MODIFIED|The username was not modified|
|400|USERNAME_OCCUPIED|The provided username is already occupied|
|401|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -48,6 +48,7 @@ Bool = auth.cancelCode({phone_number='string', phone_code_hash='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|PHONE_CODE_EXPIRED|The phone code you provided has expired, this may happen if it was sent to any chat on telegram (if the code is sent through a telegram chat (not the official account) to avoid it append or prepend to the code some chars)|
|400|PHONE_NUMBER_INVALID|The phone number is invalid|

View File

@ -49,8 +49,10 @@ messages.AffectedHistory = channels.deleteUserHistory({channel=InputChannel, use
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|USER_ID_INVALID|The provided user ID is invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -53,6 +53,7 @@ Updates = channels.editAdmin({channel=InputChannel, user_id=InputUser, admin_rig
|400|ADMINS_TOO_MUCH|There are too many admins|
|400|BOT_CHANNELS_NA|Bots can't edit admin privileges|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|USER_CREATOR|You can't leave this channel, because you're its creator|

View File

@ -54,5 +54,6 @@ Updates = channels.editPhoto({channel=InputChannel, photo=InputChatPhoto, })
|400|PHOTO_CROP_SIZE_SMALL|Photo is too small|
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|
|400|PHOTO_INVALID|Photo invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -51,5 +51,6 @@ messages.Chats = channels.getChannels({id={InputChannel}, })
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -51,6 +51,7 @@ messages.Messages = channels.getMessages({channel=InputChannel, id={InputMessage
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MESSAGE_IDS_EMPTY|No message ids were provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -54,8 +54,11 @@ Updates = channels.joinChannel({channel=InputChannel, })
|400|INVITE_HASH_EXPIRED|The invite link has expired|
|400|INVITE_HASH_INVALID|The invite hash is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|USER_ALREADY_PARTICIPANT|The user is already in the group|
|400|USER_CHANNELS_TOO_MUCH|One of the users you tried to add is already in too many channels/supergroups|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|
|-503|Timeout|Timeout while fetching data|

View File

@ -51,5 +51,6 @@ Bool = channels.readHistory({channel=InputChannel, max_id=int, })
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -50,6 +50,8 @@ Bool = channels.reportSpam({channel=InputChannel, user_id=InputUser, id={int}, }
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|USER_ID_INVALID|The provided user ID is invalid|

View File

@ -49,5 +49,6 @@ Updates = channels.toggleSignatures({channel=InputChannel, enabled=Bool, })
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHAT_ID_INVALID|The provided chat id is invalid|

View File

@ -45,6 +45,7 @@ Config = help.getConfig({})
|400|CONNECTION_DEVICE_MODEL_EMPTY|Device model empty|
|400|CONNECTION_NOT_INITED|Connection not initialized|
|400|CONNECTION_SYSTEM_EMPTY|Connection system empty|
|400|INPUT_LAYER_INVALID|The provided layer is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -38,3 +38,10 @@ Or, if you're into Lua:
NearestDc = help.getNearestDc({})
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -49,6 +49,7 @@ Updates = messages.createChat({users={InputUser}, title='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|CHAT_INVALID|Invalid chat|
|400|CHAT_TITLE_EMPTY|No chat title provided|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|USERS_TOO_FEW|Not enough users (to create a chat, for example)|
|403|USER_RESTRICTED|You're spamreported, you can't create channels or chats.|

View File

@ -50,6 +50,7 @@ messages.AffectedHistory = messages.deleteHistory({just_clear=Bool, revoke=Bool,
| Code | Type | Description |
|------|----------|---------------|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|

View File

@ -48,6 +48,7 @@ Bool = messages.editChatAbout({peer=InputPeer, about='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ABOUT_NOT_MODIFIED|About text has not changed|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_NOT_MODIFIED|The pinned message wasn't modified|

View File

@ -52,6 +52,7 @@ Updates = messages.editChatPhoto({chat_id=InputPeer, photo=InputChatPhoto, })
|400|INPUT_CONSTRUCTOR_INVALID|The provided constructor is invalid|
|400|INPUT_FETCH_FAIL|Failed deserializing TL payload|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|PHOTO_CROP_SIZE_SMALL|Photo is too small|
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|

View File

@ -103,17 +103,20 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
| Code | Type | Description |
|------|----------|---------------|
|400|BUTTON_DATA_INVALID|The data of one or more of the buttons you provided is invalid|
|400|BUTTON_TYPE_INVALID|The type of one or more of the buttons you provided is invalid|
|400|BUTTON_URL_INVALID|Button URL invalid|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|MEDIA_PREV_INVALID|Previous media invalid|
|400|MESSAGE_EDIT_TIME_EXPIRED|You can't edit this message anymore, too much time has passed since its creation.|
|400|MESSAGE_EMPTY|The provided message is empty|
|400|MESSAGE_ID_INVALID|The provided message id is invalid|
|400|MESSAGE_NOT_MODIFIED|The message text has not changed|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|SCHEDULE_DATE_INVALID|Invalid schedule date provided|
|400|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|403|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|

View File

@ -51,5 +51,6 @@ ExportedChatInvite = messages.exportChatInvite({peer=InputPeer, })
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_ID_INVALID|The provided chat id is invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -73,6 +73,7 @@ Updates = messages.forwardMessages({silent=Bool, background=Bool, with_my_score=
|400|YOU_BLOCKED_USER|You blocked this user|
|403|CHAT_SEND_GIFS_FORBIDDEN|You can't send gifs in this chat|
|403|CHAT_SEND_MEDIA_FORBIDDEN|You can't send media in this chat|
|403|CHAT_SEND_POLL_FORBIDDEN|You can't send polls in this chat|
|403|CHAT_SEND_STICKERS_FORBIDDEN|You can't send stickers in this chat.|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|420|SLOWMODE_WAIT_X|Slowmode is enabled in this chat: you must wait for the specified number of seconds before sending another message to the chat.|

View File

@ -55,6 +55,7 @@ messages.Dialogs = messages.getDialogs({exclude_pinned=Bool, folder_id=int, offs
|------|----------|---------------|
|400|INPUT_CONSTRUCTOR_INVALID|The provided constructor is invalid|
|400|OFFSET_PEER_ID_INVALID|The provided offset peer is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|
|-503|Timeout|Timeout while fetching data|

View File

@ -48,6 +48,7 @@ messages.MessageEditData = messages.getMessageEditData({peer=InputPeer, id=int,
| Code | Type | Description |
|------|----------|---------------|
|400|MESSAGE_ID_INVALID|The provided message id is invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|403|MESSAGE_AUTHOR_REQUIRED|Message author required|

View File

@ -55,5 +55,6 @@ Vector_of_int = messages.getMessagesViews({peer=InputPeer, id={int}, increment=B
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -50,5 +50,6 @@ messages.PeerDialogs = messages.getPeerDialogs({peers={InputDialogPeer}, })
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -47,11 +47,13 @@ Updates = messages.importChatInvite({hash='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHANNELS_TOO_MUCH|You have joined too many channels/supergroups|
|400|INVITE_HASH_EMPTY|The invite hash is empty|
|400|INVITE_HASH_EXPIRED|The invite link has expired|
|400|INVITE_HASH_INVALID|The invite hash is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|USER_ALREADY_PARTICIPANT|The user is already in the group|
|400|USERS_TOO_MUCH|The maximum number of users has been exceeded (to create a chat, for example)|

View File

@ -43,3 +43,13 @@ Or, if you're into Lua:
messages.AffectedHistory = messages.readMentions({peer=InputPeer, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -55,8 +55,11 @@ Updates = messages.sendInlineBotResult({silent=Bool, background=Bool, clear_draf
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_RESTRICTED|You can't send messages in this chat, you were restricted|
|400|INLINE_RESULT_EXPIRED|The inline query expired|
|400|MEDIA_EMPTY|The provided media object is invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|QUERY_ID_EMPTY|The query ID is empty|
|400|RESULT_ID_EMPTY|Result ID empty|
@ -64,8 +67,11 @@ Updates = messages.sendInlineBotResult({silent=Bool, background=Bool, clear_draf
|400|WEBPAGE_CURL_FAILED|Failure while fetching the webpage with cURL|
|400|WEBPAGE_MEDIA_EMPTY|Webpage media empty|
|400|YOU_BLOCKED_USER|You blocked this user|
|403|CHAT_SEND_GIFS_FORBIDDEN|You can't send gifs in this chat|
|403|CHAT_SEND_INLINE_FORBIDDEN|You can't send inline messages in this group|
|403|CHAT_SEND_MEDIA_FORBIDDEN|You can't send media in this chat|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|420|SLOWMODE_WAIT_X|Slowmode is enabled in this chat: you must wait for the specified number of seconds before sending another message to the chat.|
|-503|Timeout|Timeout while fetching data|

View File

@ -107,6 +107,7 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
|------|----------|---------------|
|400|BUTTON_DATA_INVALID|The data of one or more of the buttons you provided is invalid|
|400|BUTTON_TYPE_INVALID|The type of one or more of the buttons you provided is invalid|
|400|BUTTON_URL_INVALID|Button URL invalid|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
@ -125,15 +126,22 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|
|400|PHOTO_INVALID_DIMENSIONS|The photo dimensions are invalid|
|400|PHOTO_SAVE_FILE_INVALID|Internal issues, try again later|
|400|POLL_ANSWERS_INVALID|Invalid poll answers were provided|
|400|POLL_OPTION_DUPLICATE|Duplicate poll options provided|
|400|QUIZ_CORRECT_ANSWERS_EMPTY|No correct quiz answer was specified|
|400|REPLY_MARKUP_BUY_EMPTY|Reply markup for buy button empty|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|TTL_MEDIA_INVALID|Invalid media Time To Live was provided|
|400|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|400|USER_IS_BLOCKED|You were blocked by this user|
|400|USER_IS_BOT|Bots can't send messages to other bots|
|400|WEBPAGE_CURL_FAILED|Failure while fetching the webpage with cURL|
|400|WEBPAGE_MEDIA_EMPTY|Webpage media empty|
|400|YOU_BLOCKED_USER|You blocked this user|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|403|CHAT_SEND_GIFS_FORBIDDEN|You can't send gifs in this chat|
|403|CHAT_SEND_MEDIA_FORBIDDEN|You can't send media in this chat|
|403|CHAT_SEND_STICKERS_FORBIDDEN|You can't send stickers in this chat.|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|420|SLOWMODE_WAIT_X|Slowmode is enabled in this chat: you must wait for the specified number of seconds before sending another message to the chat.|
|-503|Timeout|Timeout while fetching data|

View File

@ -123,6 +123,7 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
|400|MESSAGE_TOO_LONG|The provided message is too long|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|PINNED_DIALOGS_TOO_MUCH|Too many pinned dialogs|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|SCHEDULE_BOT_NOT_ALLOWED|Bots cannot schedule messages|
|400|SCHEDULE_TOO_MUCH|There are too many scheduled messages|

View File

@ -65,6 +65,7 @@ Bool = messages.setInlineBotResults({gallery=Bool, private=Bool, query_id=long,
|400|QUERY_ID_INVALID|The query ID is invalid|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|RESULT_TYPE_INVALID|Result type invalid|
|400|RESULTS_TOO_MUCH|Too many results were provided|
|400|SEND_MESSAGE_TYPE_INVALID|The message type is invalid|
|400|START_PARAM_INVALID|Start parameter invalid|
|400|WEBDOCUMENT_SIZE_TOO_BIG|Webdocument is too big!|

View File

@ -53,6 +53,7 @@ Bool = messages.setTyping({peer=InputPeer, action=SendMessageAction, })
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_ID_INVALID|The provided chat id is invalid|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|400|USER_IS_BLOCKED|You were blocked by this user|

View File

@ -50,9 +50,11 @@ MessageMedia = messages.uploadMedia({peer=InputPeer, media=InputMedia, })
|------|----------|---------------|
|400|BOT_MISSING|This method can only be run by a bot|
|400|FILE_PARTS_INVALID|The number of file parts is invalid|
|400|IMAGE_PROCESS_FAILED|Failure while processing image|
|400|MEDIA_INVALID|Media invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|
|400|WEBPAGE_CURL_FAILED|Failure while fetching the webpage with cURL|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -56,6 +56,7 @@ upload.File = upload.getFile({precise=Bool, location=InputFileLocation, offset=i
|400|LOCATION_INVALID|The provided location is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|OFFSET_INVALID|The provided offset is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|406|FILEREF_UPGRADE_NEEDED|The client has to be updated in order to support [file references](https://core.telegram.org/api/file_reference)|
|401|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|
|-503|Timeout|Timeout while fetching data|

View File

@ -55,6 +55,7 @@ Bool = upload.saveBigFilePart({file_id=long, file_part=int, file_total_parts=int
|400|FILE_PART_SIZE_CHANGED|Provided file part size has changed|
|400|FILE_PART_SIZE_INVALID|The provided file part size is invalid|
|400|FILE_PARTS_INVALID|The number of file parts is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -52,6 +52,7 @@ Bool = upload.saveFilePart({file_id=long, file_part=int, bytes='bytes', })
|400|FILE_PART_EMPTY|The provided file part is empty|
|400|FILE_PART_INVALID|The file part number is invalid|
|400|INPUT_FETCH_FAIL|Failed deserializing TL payload|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -47,6 +47,7 @@ Vector_of_User = users.getUsers({id={InputUser}, })
| Code | Type | Description |
|------|----------|---------------|
|400|INPUT_LAYER_INVALID|The provided layer is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|

View File

@ -17,7 +17,7 @@ Update handling can be done in different ways:
## Self-restart on webhosts
When running the `loop()` method via web, MadelineProto will automatically enable a **magical self-restart hack**, to keep the bot running even on webhosts with limited execution time.
When running the `loop()` method via web, MadelineProto will automatically enable a **magical self-restart hack** (callback ID `restarter`), to keep the bot running even on webhosts with limited execution time.
Locking will also be handled automatically (as well as disconnection from the user that opened the page), so even if you start the script via web several times, only one instance will be running at a time (no need to do flocking manually!).
@ -50,59 +50,85 @@ The `removeCallback` will return true if the callback exists and it was removed
## Async Event driven
```php
class EventHandler extends \danog\MadelineProto\EventHandler
use danog\MadelineProto\EventHandler;
use danog\MadelineProto\Tools;
use danog\MadelineProto\API;
use danog\MadelineProto\Logger;
use danog\MadelineProto\RPCErrorException;
/**
* Event handler class.
*/
class MyEventHandler extends EventHandler
{
public function __construct($MadelineProto)
/**
* @var int|string Username or ID of bot admin
*/
const ADMIN = "danogentili"; // Change this
/**
* Get peer(s) where to report errors
*
* @return int|string|array
*/
public function getReportPeers()
{
parent::__construct($MadelineProto);
return [self::ADMIN];
}
public function onUpdateSomethingElse($update)
/**
* Handle updates from supergroups and channels
*
* @param array $update Update
*
* @return void
*/
public function onUpdateNewChannelMessage(array $update): \Generator
{
// See the docs for a full list of updates: http://docs.madelineproto.xyz/API_docs/types/Update.html
return $this->onUpdateNewMessage($update);
}
public function onUpdateNewChannelMessage($update)
/**
* Handle updates from users.
*
* @param array $update Update
*
* @return \Generator
*/
public function onUpdateNewMessage(array $update): \Generator
{
yield $this->onUpdateNewMessage($update);
}
public function onUpdateNewMessage($update)
{
if (isset($update['message']['out']) && $update['message']['out']) {
if ($update['message']['_'] === 'messageEmpty' || $update['message']['out'] ?? false) {
return;
}
$res = json_encode($update, JSON_PRETTY_PRINT);
if ($res == '') {
$res = var_export($update, true);
}
$res = \json_encode($update, JSON_PRETTY_PRINT);
try {
yield $this->messages->sendMessage(['peer' => $update, 'message' => $res, 'reply_to_msg_id' => $update['message']['id']]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
yield $this->messages->sendMessage(['peer' => '@danogentili', 'message' => (string) $e]);
}
try {
if (isset($update['message']['media']) && ($update['message']['media']['_'] == 'messageMediaPhoto' || $update['message']['media']['_'] == 'messageMediaDocument')) {
$time = microtime(true);
$file = yield $this->downloadToDir($update, '/tmp');
yield $this->messages->sendMessage(['peer' => $update, 'message' => 'Downloaded to '.$file.' in '.(microtime(true) - $time).' seconds', 'reply_to_msg_id' => $update['message']['id']]);
yield $this->messages->sendMessage(['peer' => $update, 'message' => "<code>$res</code>", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']);
if (isset($update['message']['media']) && $update['message']['media']['_'] !== 'messageMediaGame') {
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
}
} catch (RPCErrorException $e) {
$this->report("Surfaced: $e");
} catch (Exception $e) {
if (\stripos($e->getMessage(), 'invalid constructor given') === false) {
$this->report("Surfaced: $e");
}
} catch (\danog\MadelineProto\RPCErrorException $e) {
yield $this->messages->sendMessage(['peer' => '@danogentili', 'message' => (string) $e]);
}
}
}
$settings = [
'logger' => [
'logger_level' => 5
],
'serialization' => [
'serialization_interval' => 30,
],
];
$MadelineProto = new \danog\MadelineProto\API('bot.madeline');
$MadelineProto->async(true);
$MadelineProto->loop(function () use ($MadelineProto) {
yield $MadelineProto->start();
yield $MadelineProto->setEventHandler('\EventHandler');
});
$MadelineProto->loop();
$MadelineProto = new API('bot.madeline', $settings);
$MadelineProto->startAndLoop(MyEventHandler::class);
```
This will create an event handler class `EventHandler`, create a MadelineProto session, and set the event handler class to our newly created event handler.
This will create an event handler class `MyEventHandler`, create a MadelineProto session, and set the event handler class to our newly created event handler.
The **new** `startAndLoop` method automatically initializes MadelineProto, **enables async**, logs in the user/bot, initializes error reporting, catches and reports all errors surfacing from the event loop to the peers returned by the `getReportPeers` method.
This yield syntax might be new to you, even if you already used MadelineProto in the past.
It's a new syntax to allow async **parallel processing** of updates and HUGE speed improvements.
@ -126,144 +152,54 @@ If you intend to use your own constructor in the event handler, make sure to cal
The update handling loop is started by the `$MadelineProto->loop()` method, and it will automatically restart the script if execution time runs out.
To break out of the loop just call `die();`, or throw an exception from within (make sure to catch it outside, in the `$MadelineProto->loop()` call).
To forecfully restart and apply changes made to the event handler class, call `$MadelineProto->restart();`.
## Async Combined event driven
## Async event driven (multiaccount)
```php
class EventHandler extends \danog\MadelineProto\CombinedEventHandler
{
public function __construct($CombinedMadelineProto)
{
parent::__construct($CombinedMadelineProto);
}
public function onUpdateSomethingElse($update, $session)
{
// See the docs for a full list of updates: http://docs.madelineproto.xyz/API_docs/types/Update.html
}
public function onUpdateNewChannelMessage($update, $session)
{
yield $this->onUpdateNewMessage($update, $session);
}
public function onUpdateNewMessage($update, $session)
{
if (isset($update['message']['out']) && $update['message']['out']) {
return;
}
$res = json_encode($update, JSON_PRETTY_PRINT);
if ($res == '') {
$res = var_export($update, true);
}
use danog\MadelineProto\EventHandler;
use danog\MadelineProto\Tools;
use danog\MadelineProto\API;
use danog\MadelineProto\Logger;
use danog\MadelineProto\RPCErrorException;
try {
yield $this->{$session}->messages->sendMessage(['peer' => $update, 'message' => $res, 'reply_to_msg_id' => $update['message']['id']]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
yield $this->{$session}->messages->sendMessage(['peer' => '@danogentili', 'message' => (string) $e]);
}
// Normal event handler definition as above
try {
if (isset($update['message']['media']) && ($update['message']['media']['_'] == 'messageMediaPhoto' || $update['message']['media']['_'] == 'messageMediaDocument')) {
$time = microtime(true);
$file = yield $this->{$session}->downloadToDir($update, '/tmp');
yield $this->{$session}->messages->sendMessage(['peer' => $update, 'message' => 'Downloaded to '.$file.' in '.(microtime(true) - $time).' seconds', 'reply_to_msg_id' => $update['message']['id']]);
}
} catch (\danog\MadelineProto\RPCErrorException $e) {
yield $this->{$session}->messages->sendMessage(['peer' => '@danogentili', 'message' => (string) $e]);
}
}
$MadelineProtos = [];
foreach ([
'bot.madeline' => 'Bot Login',
'user.madeline' => 'Userbot login',
'user2.madeline' => 'Userbot login (2)'
] as $session => $message) {
Logger::log($message, Logger::WARNING);
$MadelineProto = new API($session);
$MadelineProto->async(true);
$MadelineProto->loop(function () use ($MadelineProto) {
yield $MadelineProto->start();
yield $MadelineProto->setEventHandler(MyEventHandler::class);
});
$MadelineProtos []= $MadelineProto->loopFork();
}
$settings = [];
$CombinedMadelineProto = new \danog\MadelineProto\CombinedAPI('combined_session.madeline', ['bot.madeline' => $settings, 'user.madeline' => $settings, 'user2.madeline' => $settings]);
$CombinedMadelineProto->async(true);
$CombinedMadelineProto->loop(function () use ($CombinedMadelineProto) {
$res = [];
foreach ([
'bot.madeline' => 'Bot Login',
'user.madeline' => 'Userbot login',
'user2.madeline' => 'Userbot login (2)'
] as $session => $message) {
\danog\MadelineProto\Logger::log($message, \danog\MadelineProto\Logger::WARNING);
$res []= $CombinedMadelineProto->instances[$session]->start();
do {
$thrown = false;
try {
Tools::wait(Tools::all($MadelineProtos));
} catch (\Throwable $e) {
$thrown = true;
try {
$MadelineProto->report("Surfaced: $e");
} catch (\Throwable $e) {
$MadelineProto->logger((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR);
}
}
yield $CombinedMadelineProto->all($res);
yield $CombinedMadelineProto->setEventHandler('\EventHandler');
});
$CombinedMadelineProto->loop();
} while ($thrown);
```
This will create an event handler class `EventHandler`, create a **combined** MadelineProto session with session files `bot.madeline`, `user.madeline`, `user2.madeline`, and set the event handler class to our newly created event handler.
This yield syntax might be new to you, even if you already used MadelineProto in the past.
It's a new syntax to allow async **parallel processing** of updates and HUGE speed improvements.
It was recently introduced in MadelineProto, [here's a full explanation](ASYNC.html).
If your code still relies on the old synchronous behaviour, it's still supported, but I HIGHLY recommend you switch to the new async syntax: it's __super__ easy, [just add a `yield` in front of method calls](ASYNC.html)!
When an [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html) is received, the corresponding `onUpdateType` event handler method is called.
To get a list of all possible update types, [click here](https://docs.madelineproto.xyz/API_docs/types/Update.html).
If such a method does not exist, the `onAny` event handler method is called.
If the `onAny` event handler method does not exist, the update is ignored.
The first paramter of the event handler method will always be the [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html), the second parameter will always be the **session name**.
The `onLoop` method is not recommended anymore, use AMPHP's [repeat](https://amphp.org/amp/event-loop/api#repeat) or MadelineProto's [async loop API](ASYNC.html#async-loop-apis) to schedule actions in a cron-like manner.
To access the `$MadelineProto` instance of the account that sent the update, from inside of the event handler, simply access `$this->{$session_name}` (`$session_name` is the second parameter value of the event handler method, or just the session filename):
```php
$this->{$session_name}->messages->sendMessage(['peer' => '@danogentili', 'message' => 'hi']);
$this->{'user2.madeline'}->messages->sendMessage(['peer' => '@danogentili', 'message' => 'hi2']);
```
If you intend to use your own constructor in the event handler, make sure to call the parent construtor with the only parameter provided to your constructor.
If you need to use the [__sleep](https://www.php.net/manual/en/language.oop5.magic.php#object.sleep) function, make sure it is called `__magic_sleep`, instead.
The update handling loop is started by the `$MadelineProto->loop()` method, and it will automatically restart the script if execution time runs out.
To break out of the loop just call `die();`, or throw an exception from within (make sure to catch it outside, in the `$MadelineProto->loop()` call).
## Async callback
```php
$MadelineProto = new \danog\MadelineProto\API('bot.madeline');
$MadelineProto->start();
$MadelineProto->setCallback(function ($update) use ($MadelineProto) {
if (isset($update['message']['out']) && $update['message']['out']) {
return;
}
$res = json_encode($update, JSON_PRETTY_PRINT);
if ($res == '') {
$res = var_export($update, true);
}
try {
yield $MadelineProto->messages->sendMessage(['peer' => $update, 'message' => $res, 'reply_to_msg_id' => $update['message']['id']]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
yield $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => (string) $e]);
}
});
$MadelineProto->async(true);
$MadelineProto->loop();
```
When an [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html) is received, the provided callback function is called.
The update handling loop is started by the `$MadelineProto->loop()` method, and it will automatically restart the script if execution time runs out.
This yield syntax might be new to you, even if you already used MadelineProto in the past.
It's a new syntax to allow async **parallel processing** of updates and HUGE speed improvements.
It was recently introduced in MadelineProto, [here's a full explanation](ASYNC.html).
If your code still relies on the old synchronous behaviour, it's still supported, but I HIGHLY recommend you switch to the new async syntax: it's __super__ easy, [just add a `yield` in front of method calls](ASYNC.html)!
To break out of the loop just call `die();`, or throw an exception from within (make sure to catch it outside, in the `$MadelineProto->loop()` call).
Usage is the same as for [the normal event handler](#async-event-driven), with the difference that by using `loopFork`, multiple accounts can receive and handle updates in parallel, each with its own event handler instance.
## Noop

View File

@ -49,6 +49,7 @@ User = account.changePhone({phone_number='string', phone_code_hash='string', pho
| Code | Type | Description |
|------|----------|---------------|
|400|PHONE_CODE_EMPTY|phone_code is missing|
|400|PHONE_NUMBER_INVALID|The phone number is invalid|

View File

@ -48,5 +48,6 @@ Bool = account.checkUsername({username='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|USERNAME_INVALID|The provided username is not valid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -43,3 +43,10 @@ Or, if you're into Lua:
Bool = account.finishTakeoutSession({success=Bool, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|403|TAKEOUT_REQUIRED|A takeout session has to be initialized, first|

View File

@ -38,3 +38,10 @@ Or, if you're into Lua:
account.Authorizations = account.getAuthorizations({})
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -49,3 +49,10 @@ Or, if you're into Lua:
account.Takeout = account.initTakeoutSession({contacts=Bool, message_users=Bool, message_chats=Bool, message_megagroups=Bool, message_channels=Bool, files=Bool, file_max_size=int, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|420|TAKEOUT_INIT_DELAY_X|Wait X seconds before initing takeout|

View File

@ -48,6 +48,7 @@ Bool = account.updateNotifySettings({peer=InputNotifyPeer, settings=InputPeerNot
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|SETTINGS_INVALID|Invalid settings were provided|

View File

@ -50,6 +50,7 @@ User = account.updateUsername({username='string', })
|400|USERNAME_INVALID|The provided username is not valid|
|400|USERNAME_NOT_MODIFIED|The username was not modified|
|400|USERNAME_OCCUPIED|The provided username is already occupied|
|401|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -48,6 +48,7 @@ Bool = auth.cancelCode({phone_number='string', phone_code_hash='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|PHONE_CODE_EXPIRED|The phone code you provided has expired, this may happen if it was sent to any chat on telegram (if the code is sent through a telegram chat (not the official account) to avoid it append or prepend to the code some chars)|
|400|PHONE_NUMBER_INVALID|The phone number is invalid|

View File

@ -49,8 +49,10 @@ messages.AffectedHistory = channels.deleteUserHistory({channel=InputChannel, use
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|USER_ID_INVALID|The provided user ID is invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -52,6 +52,7 @@ Updates = channels.editAdmin({channel=InputChannel, user_id=InputUser, admin_rig
|400|ADMINS_TOO_MUCH|There are too many admins|
|400|BOT_CHANNELS_NA|Bots can't edit admin privileges|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|USER_CREATOR|You can't leave this channel, because you're its creator|

View File

@ -54,5 +54,6 @@ Updates = channels.editPhoto({channel=InputChannel, photo=InputChatPhoto, })
|400|PHOTO_CROP_SIZE_SMALL|Photo is too small|
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|
|400|PHOTO_INVALID|Photo invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -51,5 +51,6 @@ messages.Chats = channels.getChannels({id={InputChannel}, })
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -51,6 +51,7 @@ messages.Messages = channels.getMessages({channel=InputChannel, id={InputMessage
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MESSAGE_IDS_EMPTY|No message ids were provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -54,8 +54,11 @@ Updates = channels.joinChannel({channel=InputChannel, })
|400|INVITE_HASH_EXPIRED|The invite link has expired|
|400|INVITE_HASH_INVALID|The invite hash is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|USER_ALREADY_PARTICIPANT|The user is already in the group|
|400|USER_CHANNELS_TOO_MUCH|One of the users you tried to add is already in too many channels/supergroups|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|
|-503|Timeout|Timeout while fetching data|

View File

@ -51,5 +51,6 @@ Bool = channels.readHistory({channel=InputChannel, max_id=int, })
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -50,6 +50,8 @@ Bool = channels.reportSpam({channel=InputChannel, user_id=InputUser, id={int}, }
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|USER_ID_INVALID|The provided user ID is invalid|

View File

@ -49,5 +49,6 @@ Updates = channels.toggleSignatures({channel=InputChannel, enabled=Bool, })
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHAT_ID_INVALID|The provided chat id is invalid|

View File

@ -45,6 +45,7 @@ Config = help.getConfig({})
|400|CONNECTION_DEVICE_MODEL_EMPTY|Device model empty|
|400|CONNECTION_NOT_INITED|Connection not initialized|
|400|CONNECTION_SYSTEM_EMPTY|Connection system empty|
|400|INPUT_LAYER_INVALID|The provided layer is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -38,3 +38,10 @@ Or, if you're into Lua:
NearestDc = help.getNearestDc({})
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -49,6 +49,7 @@ Updates = messages.createChat({users={InputUser}, title='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|CHAT_INVALID|Invalid chat|
|400|CHAT_TITLE_EMPTY|No chat title provided|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|USERS_TOO_FEW|Not enough users (to create a chat, for example)|
|403|USER_RESTRICTED|You're spamreported, you can't create channels or chats.|

View File

@ -50,6 +50,7 @@ messages.AffectedHistory = messages.deleteHistory({just_clear=Bool, revoke=Bool,
| Code | Type | Description |
|------|----------|---------------|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|

View File

@ -48,6 +48,7 @@ Bool = messages.editChatAbout({peer=InputPeer, about='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ABOUT_NOT_MODIFIED|About text has not changed|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_NOT_MODIFIED|The pinned message wasn't modified|

View File

@ -52,6 +52,7 @@ Updates = messages.editChatPhoto({chat_id=InputPeer, photo=InputChatPhoto, })
|400|INPUT_CONSTRUCTOR_INVALID|The provided constructor is invalid|
|400|INPUT_FETCH_FAIL|Failed deserializing TL payload|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|PHOTO_CROP_SIZE_SMALL|Photo is too small|
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|

View File

@ -102,17 +102,20 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
| Code | Type | Description |
|------|----------|---------------|
|400|BUTTON_DATA_INVALID|The data of one or more of the buttons you provided is invalid|
|400|BUTTON_TYPE_INVALID|The type of one or more of the buttons you provided is invalid|
|400|BUTTON_URL_INVALID|Button URL invalid|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|MEDIA_PREV_INVALID|Previous media invalid|
|400|MESSAGE_EDIT_TIME_EXPIRED|You can't edit this message anymore, too much time has passed since its creation.|
|400|MESSAGE_EMPTY|The provided message is empty|
|400|MESSAGE_ID_INVALID|The provided message id is invalid|
|400|MESSAGE_NOT_MODIFIED|The message text has not changed|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|SCHEDULE_DATE_INVALID|Invalid schedule date provided|
|400|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|403|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|

View File

@ -51,5 +51,6 @@ ExportedChatInvite = messages.exportChatInvite({peer=InputPeer, })
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_ID_INVALID|The provided chat id is invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -72,6 +72,7 @@ Updates = messages.forwardMessages({silent=Bool, background=Bool, with_my_score=
|400|YOU_BLOCKED_USER|You blocked this user|
|403|CHAT_SEND_GIFS_FORBIDDEN|You can't send gifs in this chat|
|403|CHAT_SEND_MEDIA_FORBIDDEN|You can't send media in this chat|
|403|CHAT_SEND_POLL_FORBIDDEN|You can't send polls in this chat|
|403|CHAT_SEND_STICKERS_FORBIDDEN|You can't send stickers in this chat.|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|420|SLOWMODE_WAIT_X|Slowmode is enabled in this chat: you must wait for the specified number of seconds before sending another message to the chat.|

View File

@ -55,6 +55,7 @@ messages.Dialogs = messages.getDialogs({exclude_pinned=Bool, folder_id=int, offs
|------|----------|---------------|
|400|INPUT_CONSTRUCTOR_INVALID|The provided constructor is invalid|
|400|OFFSET_PEER_ID_INVALID|The provided offset peer is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|
|-503|Timeout|Timeout while fetching data|

View File

@ -48,6 +48,7 @@ messages.MessageEditData = messages.getMessageEditData({peer=InputPeer, id=int,
| Code | Type | Description |
|------|----------|---------------|
|400|MESSAGE_ID_INVALID|The provided message id is invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|403|MESSAGE_AUTHOR_REQUIRED|Message author required|

View File

@ -55,5 +55,6 @@ Vector_of_int = messages.getMessagesViews({peer=InputPeer, id={int}, increment=B
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -50,5 +50,6 @@ messages.PeerDialogs = messages.getPeerDialogs({peers={InputDialogPeer}, })
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -47,11 +47,13 @@ Updates = messages.importChatInvite({hash='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHANNELS_TOO_MUCH|You have joined too many channels/supergroups|
|400|INVITE_HASH_EMPTY|The invite hash is empty|
|400|INVITE_HASH_EXPIRED|The invite link has expired|
|400|INVITE_HASH_INVALID|The invite hash is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|USER_ALREADY_PARTICIPANT|The user is already in the group|
|400|USERS_TOO_MUCH|The maximum number of users has been exceeded (to create a chat, for example)|

View File

@ -43,3 +43,13 @@ Or, if you're into Lua:
messages.AffectedHistory = messages.readMentions({peer=InputPeer, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -54,8 +54,11 @@ Updates = messages.sendInlineBotResult({silent=Bool, background=Bool, clear_draf
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_RESTRICTED|You can't send messages in this chat, you were restricted|
|400|INLINE_RESULT_EXPIRED|The inline query expired|
|400|MEDIA_EMPTY|The provided media object is invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|QUERY_ID_EMPTY|The query ID is empty|
|400|RESULT_ID_EMPTY|Result ID empty|
@ -63,8 +66,11 @@ Updates = messages.sendInlineBotResult({silent=Bool, background=Bool, clear_draf
|400|WEBPAGE_CURL_FAILED|Failure while fetching the webpage with cURL|
|400|WEBPAGE_MEDIA_EMPTY|Webpage media empty|
|400|YOU_BLOCKED_USER|You blocked this user|
|403|CHAT_SEND_GIFS_FORBIDDEN|You can't send gifs in this chat|
|403|CHAT_SEND_INLINE_FORBIDDEN|You can't send inline messages in this group|
|403|CHAT_SEND_MEDIA_FORBIDDEN|You can't send media in this chat|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|420|SLOWMODE_WAIT_X|Slowmode is enabled in this chat: you must wait for the specified number of seconds before sending another message to the chat.|
|-503|Timeout|Timeout while fetching data|

View File

@ -106,6 +106,7 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
|------|----------|---------------|
|400|BUTTON_DATA_INVALID|The data of one or more of the buttons you provided is invalid|
|400|BUTTON_TYPE_INVALID|The type of one or more of the buttons you provided is invalid|
|400|BUTTON_URL_INVALID|Button URL invalid|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
@ -124,15 +125,22 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|
|400|PHOTO_INVALID_DIMENSIONS|The photo dimensions are invalid|
|400|PHOTO_SAVE_FILE_INVALID|Internal issues, try again later|
|400|POLL_ANSWERS_INVALID|Invalid poll answers were provided|
|400|POLL_OPTION_DUPLICATE|Duplicate poll options provided|
|400|QUIZ_CORRECT_ANSWERS_EMPTY|No correct quiz answer was specified|
|400|REPLY_MARKUP_BUY_EMPTY|Reply markup for buy button empty|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|TTL_MEDIA_INVALID|Invalid media Time To Live was provided|
|400|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|400|USER_IS_BLOCKED|You were blocked by this user|
|400|USER_IS_BOT|Bots can't send messages to other bots|
|400|WEBPAGE_CURL_FAILED|Failure while fetching the webpage with cURL|
|400|WEBPAGE_MEDIA_EMPTY|Webpage media empty|
|400|YOU_BLOCKED_USER|You blocked this user|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|403|CHAT_SEND_GIFS_FORBIDDEN|You can't send gifs in this chat|
|403|CHAT_SEND_MEDIA_FORBIDDEN|You can't send media in this chat|
|403|CHAT_SEND_STICKERS_FORBIDDEN|You can't send stickers in this chat.|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|
|420|SLOWMODE_WAIT_X|Slowmode is enabled in this chat: you must wait for the specified number of seconds before sending another message to the chat.|
|-503|Timeout|Timeout while fetching data|

View File

@ -122,6 +122,7 @@ MadelineProto supports all html entities supported by [html_entity_decode](http:
|400|MESSAGE_TOO_LONG|The provided message is too long|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|PINNED_DIALOGS_TOO_MUCH|Too many pinned dialogs|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|SCHEDULE_BOT_NOT_ALLOWED|Bots cannot schedule messages|
|400|SCHEDULE_TOO_MUCH|There are too many scheduled messages|

View File

@ -65,6 +65,7 @@ Bool = messages.setInlineBotResults({gallery=Bool, private=Bool, query_id=long,
|400|QUERY_ID_INVALID|The query ID is invalid|
|400|REPLY_MARKUP_INVALID|The provided reply markup is invalid|
|400|RESULT_TYPE_INVALID|Result type invalid|
|400|RESULTS_TOO_MUCH|Too many results were provided|
|400|SEND_MESSAGE_TYPE_INVALID|The message type is invalid|
|400|START_PARAM_INVALID|Start parameter invalid|
|400|WEBDOCUMENT_SIZE_TOO_BIG|Webdocument is too big!|

View File

@ -53,6 +53,7 @@ Bool = messages.setTyping({peer=InputPeer, action=SendMessageAction, })
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|CHAT_ID_INVALID|The provided chat id is invalid|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|USER_BANNED_IN_CHANNEL|You're banned from sending messages in supergroups/channels|
|400|USER_IS_BLOCKED|You were blocked by this user|

View File

@ -50,9 +50,11 @@ MessageMedia = messages.uploadMedia({peer=InputPeer, media=InputMedia, })
|------|----------|---------------|
|400|BOT_MISSING|This method can only be run by a bot|
|400|FILE_PARTS_INVALID|The number of file parts is invalid|
|400|IMAGE_PROCESS_FAILED|Failure while processing image|
|400|MEDIA_INVALID|Media invalid|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|
|400|WEBPAGE_CURL_FAILED|Failure while fetching the webpage with cURL|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -55,6 +55,7 @@ upload.File = upload.getFile({location=InputFileLocation, offset=int, limit=int,
|400|LOCATION_INVALID|The provided location is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|OFFSET_INVALID|The provided offset is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|406|FILEREF_UPGRADE_NEEDED|The client has to be updated in order to support [file references](https://core.telegram.org/api/file_reference)|
|401|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|
|-503|Timeout|Timeout while fetching data|

View File

@ -55,6 +55,7 @@ Bool = upload.saveBigFilePart({file_id=long, file_part=int, file_total_parts=int
|400|FILE_PART_SIZE_CHANGED|Provided file part size has changed|
|400|FILE_PART_SIZE_INVALID|The provided file part size is invalid|
|400|FILE_PARTS_INVALID|The number of file parts is invalid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -52,6 +52,7 @@ Bool = upload.saveFilePart({file_id=long, file_part=int, bytes='bytes', })
|400|FILE_PART_EMPTY|The provided file part is empty|
|400|FILE_PART_INVALID|The file part number is invalid|
|400|INPUT_FETCH_FAIL|Failed deserializing TL payload|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -47,6 +47,7 @@ Vector_of_User = users.getUsers({id={InputUser}, })
| Code | Type | Description |
|------|----------|---------------|
|400|INPUT_LAYER_INVALID|The provided layer is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|

View File

@ -49,6 +49,7 @@ User = account.changePhone({phone_number='string', phone_code_hash='string', pho
| Code | Type | Description |
|------|----------|---------------|
|400|PHONE_CODE_EMPTY|phone_code is missing|
|400|PHONE_NUMBER_INVALID|The phone number is invalid|

View File

@ -48,5 +48,6 @@ Bool = account.checkUsername({username='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|USERNAME_INVALID|The provided username is not valid|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

View File

@ -43,3 +43,10 @@ Or, if you're into Lua:
Bool = account.finishTakeoutSession({success=Bool, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|403|TAKEOUT_REQUIRED|A takeout session has to be initialized, first|

View File

@ -38,3 +38,10 @@ Or, if you're into Lua:
account.Authorizations = account.getAuthorizations({})
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -49,3 +49,10 @@ Or, if you're into Lua:
account.Takeout = account.initTakeoutSession({contacts=Bool, message_users=Bool, message_chats=Bool, message_megagroups=Bool, message_channels=Bool, files=Bool, file_max_size=int, })
```
### Errors
| Code | Type | Description |
|------|----------|---------------|
|420|TAKEOUT_INIT_DELAY_X|Wait X seconds before initing takeout|

View File

@ -48,6 +48,7 @@ Bool = account.updateNotifySettings({peer=InputNotifyPeer, settings=InputPeerNot
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|SETTINGS_INVALID|Invalid settings were provided|

View File

@ -50,6 +50,7 @@ User = account.updateUsername({username='string', })
|400|USERNAME_INVALID|The provided username is not valid|
|400|USERNAME_NOT_MODIFIED|The username was not modified|
|400|USERNAME_OCCUPIED|The provided username is already occupied|
|401|AUTH_KEY_PERM_EMPTY|The temporary auth key must be binded to the permanent auth key to use these methods.|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -48,6 +48,7 @@ Bool = auth.cancelCode({phone_number='string', phone_code_hash='string', })
| Code | Type | Description |
|------|----------|---------------|
|400|PHONE_CODE_EXPIRED|The phone code you provided has expired, this may happen if it was sent to any chat on telegram (if the code is sent through a telegram chat (not the official account) to avoid it append or prepend to the code some chars)|
|400|PHONE_NUMBER_INVALID|The phone number is invalid|

View File

@ -49,8 +49,10 @@ messages.AffectedHistory = channels.deleteUserHistory({channel=InputChannel, use
| Code | Type | Description |
|------|----------|---------------|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|USER_ID_INVALID|The provided user ID is invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -52,6 +52,7 @@ Updates = channels.editAdmin({channel=InputChannel, user_id=InputUser, admin_rig
|400|ADMINS_TOO_MUCH|There are too many admins|
|400|BOT_CHANNELS_NA|Bots can't edit admin privileges|
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|CHAT_ADMIN_REQUIRED|You must be an admin in this chat to do this|
|400|INPUT_USER_DEACTIVATED|The specified user was deleted|
|400|USER_CREATOR|You can't leave this channel, because you're its creator|

View File

@ -54,5 +54,6 @@ Updates = channels.editPhoto({channel=InputChannel, photo=InputChatPhoto, })
|400|PHOTO_CROP_SIZE_SMALL|Photo is too small|
|400|PHOTO_EXT_INVALID|The extension of the photo is invalid|
|400|PHOTO_INVALID|Photo invalid|
|403|CHAT_WRITE_FORBIDDEN|You can't write in this chat|

View File

@ -51,5 +51,6 @@ messages.Chats = channels.getChannels({id={InputChannel}, })
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|

View File

@ -51,6 +51,7 @@ messages.Messages = channels.getMessages({channel=InputChannel, id={InputMessage
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MESSAGE_IDS_EMPTY|No message ids were provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|-503|Timeout|Timeout while fetching data|

View File

@ -54,8 +54,11 @@ Updates = channels.joinChannel({channel=InputChannel, })
|400|INVITE_HASH_EXPIRED|The invite link has expired|
|400|INVITE_HASH_INVALID|The invite hash is invalid|
|400|MSG_ID_INVALID|Invalid message ID provided|
|400|PEER_ID_INVALID|The provided peer id is invalid|
|400|USER_ALREADY_PARTICIPANT|The user is already in the group|
|400|USER_CHANNELS_TOO_MUCH|One of the users you tried to add is already in too many channels/supergroups|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|
|401|SESSION_PASSWORD_NEEDED|2FA is enabled, use a password to login|
|-503|Timeout|Timeout while fetching data|

View File

@ -51,5 +51,6 @@ Bool = channels.readHistory({channel=InputChannel, max_id=int, })
|400|CHANNEL_INVALID|The provided channel is invalid|
|400|CHANNEL_PRIVATE|You haven't joined this channel/supergroup|
|400|MSG_ID_INVALID|Invalid message ID provided|
|406|AUTH_KEY_DUPLICATED|An auth key with the same ID was already generated|

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