1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 19:24:42 +01:00
This commit is contained in:
Daniil Gentili 2024-08-02 18:30:54 +02:00
parent 166f0fc224
commit 2e20b88d5f

View File

@ -41,6 +41,10 @@ class RPCErrorException extends \Exception
private static array $fetchedError = [];
private const BAD = [
'CDN_SALTS_EMPTY' => true,
'BOT_POLLS_DISABLED' => true,
'PHOTO_THUMB_URL_INVALID' => true,
'ACTIVE_USER_REQUIRED' => true,
'PEER_FLOOD' => true,
'USER_DEACTIVATED_BAN' => true,
'INPUT_METHOD_INVALID' => true,
@ -148,6 +152,7 @@ class RPCErrorException extends \Exception
|| str_contains($error, 'https://telegram.org/dl')
|| str_starts_with($error, 'Received bad_msg_notification')
|| str_starts_with($error, 'No workers running')
|| str_starts_with($error, 'FLOOD_TEST_PHONE_WAIT_')
|| str_starts_with($error, 'All workers are busy. Active_queries ')
|| preg_match('/FILE_PART_\d*_MISSING/', $error)
|| !preg_match('/^[a-zA-Z0-9\._]+$/', $method)
@ -227,6 +232,7 @@ class RPCErrorException extends \Exception
'ABOUT_TOO_LONG' => new self($rpc, 'About string too long.', $code, $caller, $previous),
'ACCESS_TOKEN_EXPIRED' => new self($rpc, 'Access token expired.', $code, $caller, $previous),
'ACCESS_TOKEN_INVALID' => new self($rpc, 'Access token invalid.', $code, $caller, $previous),
'AD_EXPIRED' => new self($rpc, 'The ad has expired (too old or not found).', $code, $caller, $previous),
'ADMIN_ID_INVALID' => new self($rpc, 'The specified admin ID is invalid.', $code, $caller, $previous),
'ADMIN_RANK_EMOJI_NOT_ALLOWED' => new self($rpc, 'An admin rank cannot contain emojis.', $code, $caller, $previous),
'ADMIN_RANK_INVALID' => new self($rpc, 'The specified admin rank is invalid.', $code, $caller, $previous),
@ -245,8 +251,10 @@ class RPCErrorException extends \Exception
'AUTH_TOKEN_INVALID' => new self($rpc, 'The specified auth token is invalid.', $code, $caller, $previous),
'AUTH_TOKEN_INVALIDX' => new self($rpc, 'The specified auth token is invalid.', $code, $caller, $previous),
'AUTOARCHIVE_NOT_AVAILABLE' => new self($rpc, 'The autoarchive setting is not available at this time: please check the value of the [autoarchive_setting_available field in client config »](https://core.telegram.org/api/config#client-configuration) before calling this method.', $code, $caller, $previous),
'BALANCE_TOO_LOW' => new self($rpc, 'The transaction cannot be completed because the current [Telegram Stars balance](https://core.telegram.org/api/stars) is too low.', $code, $caller, $previous),
'BANK_CARD_NUMBER_INVALID' => new self($rpc, 'The specified card number is invalid.', $code, $caller, $previous),
'BANNED_RIGHTS_INVALID' => new self($rpc, 'You provided some invalid flags in the banned rights.', $code, $caller, $previous),
'BIRTHDAY_INVALID' => new self($rpc, 'An invalid age was specified, must be between 0 and 150 years.', $code, $caller, $previous),
'BOOST_NOT_MODIFIED' => new self($rpc, 'You\'re already [boosting](https://core.telegram.org/api/boost) the specified channel.', $code, $caller, $previous),
'BOOST_PEER_INVALID' => new self($rpc, 'The specified `boost_peer` is invalid.', $code, $caller, $previous),
'BOOSTS_EMPTY' => new self($rpc, 'No boost slots were specified.', $code, $caller, $previous),
@ -254,6 +262,7 @@ class RPCErrorException extends \Exception
'BOT_APP_BOT_INVALID' => new self($rpc, 'The bot_id passed in the inputBotAppShortName constructor is invalid.', $code, $caller, $previous),
'BOT_APP_INVALID' => new self($rpc, 'The specified bot app is invalid.', $code, $caller, $previous),
'BOT_APP_SHORTNAME_INVALID' => new self($rpc, 'The specified bot app short name is invalid.', $code, $caller, $previous),
'BOT_BUSINESS_MISSING' => new self($rpc, 'The specified bot is not a business bot (the [user](https://core.telegram.org/constructor/user).`bot_business` flag is not set).', $code, $caller, $previous),
'BOT_CHANNELS_NA' => new self($rpc, 'Bots can\'t edit admin privileges.', $code, $caller, $previous),
'BOT_COMMAND_DESCRIPTION_INVALID' => new self($rpc, 'The specified command description is invalid.', $code, $caller, $previous),
'BOT_COMMAND_INVALID' => new self($rpc, 'The specified command is invalid.', $code, $caller, $previous),
@ -261,7 +270,7 @@ class RPCErrorException extends \Exception
'BOT_GROUPS_BLOCKED' => new self($rpc, 'This bot can\'t be added to groups.', $code, $caller, $previous),
'BOT_INLINE_DISABLED' => new self($rpc, 'This bot can\'t be used in inline mode.', $code, $caller, $previous),
'BOT_INVALID' => new self($rpc, 'This is not a valid bot.', $code, $caller, $previous),
'BOT_MISSING' => new self($rpc, 'Only bots can call this method, please use [@stickers](https://t.me/stickers) if you\'re a user.', $code, $caller, $previous),
'BOT_NOT_CONNECTED_YET' => new self($rpc, null, $code, $caller, $previous),
'BOT_ONESIDE_NOT_AVAIL' => new self($rpc, 'Bots can\'t pin messages in PM just for themselves.', $code, $caller, $previous),
'BOT_PAYMENTS_DISABLED' => new \danog\MadelineProto\RPCError\BotPaymentsDisabledError($code, $caller, $previous),
'BOT_RESPONSE_TIMEOUT' => new self($rpc, 'A timeout occurred while fetching data from the bot.', $code, $caller, $previous),
@ -271,7 +280,12 @@ class RPCErrorException extends \Exception
'BROADCAST_ID_INVALID' => new self($rpc, 'Broadcast ID invalid.', $code, $caller, $previous),
'BROADCAST_PUBLIC_VOTERS_FORBIDDEN' => new \danog\MadelineProto\RPCError\BroadcastPublicVotersForbiddenError($code, $caller, $previous),
'BROADCAST_REQUIRED' => new self($rpc, 'This method can only be called on a channel, please use stats.getMegagroupStats for supergroups.', $code, $caller, $previous),
'BUSINESS_PEER_INVALID' => new self($rpc, 'Messages can\'t be set to the specified peer through the current [business connection](https://core.telegram.org/api/business#connected-bots).', $code, $caller, $previous),
'BUSINESS_RECIPIENTS_EMPTY' => new self($rpc, 'You didn\'t set any flag in inputBusinessBotRecipients, thus the bot cannot work with *any* peer.', $code, $caller, $previous),
'BUSINESS_WORK_HOURS_EMPTY' => new self($rpc, 'No work hours were specified.', $code, $caller, $previous),
'BUSINESS_WORK_HOURS_PERIOD_INVALID' => new self($rpc, 'The specified work hours are invalid, see [here »](https://core.telegram.org/api/business#opening-hours) for the exact requirements.', $code, $caller, $previous),
'BUTTON_DATA_INVALID' => new self($rpc, 'The data of one or more of the buttons you provided is invalid.', $code, $caller, $previous),
'BUTTON_POS_INVALID' => new self($rpc, 'The position of one of the keyboard buttons is invalid (i.e. a Game or Pay button not in the first position, and so on...).', $code, $caller, $previous),
'BUTTON_TEXT_INVALID' => new self($rpc, 'The specified button text is invalid.', $code, $caller, $previous),
'BUTTON_TYPE_INVALID' => new self($rpc, 'The type of one or more of the buttons you provided is invalid.', $code, $caller, $previous),
'BUTTON_URL_INVALID' => new self($rpc, 'Button URL invalid.', $code, $caller, $previous),
@ -293,6 +307,7 @@ class RPCErrorException extends \Exception
'CHANNELS_ADMIN_LOCATED_TOO_MUCH' => new self($rpc, 'The user has reached the limit of public geogroups.', $code, $caller, $previous),
'CHANNELS_ADMIN_PUBLIC_TOO_MUCH' => new self($rpc, 'You\'re admin of too many public channels, make some channels private to change the username of this channel.', $code, $caller, $previous),
'CHANNELS_TOO_MUCH' => new self($rpc, 'You have joined too many channels/supergroups.', $code, $caller, $previous),
'CHARGE_ALREADY_REFUNDED' => new self($rpc, 'The transaction was already refunded.', $code, $caller, $previous),
'CHAT_ABOUT_NOT_MODIFIED' => new self($rpc, 'About text has not changed.', $code, $caller, $previous),
'CHAT_ABOUT_TOO_LONG' => new self($rpc, 'Chat about too long.', $code, $caller, $previous),
'CHAT_ADMIN_REQUIRED' => new \danog\MadelineProto\RPCError\ChatAdminRequiredError($code, $caller, $previous),
@ -311,6 +326,8 @@ class RPCErrorException extends \Exception
'CHAT_TITLE_EMPTY' => new self($rpc, 'No chat title provided.', $code, $caller, $previous),
'CHAT_TOO_BIG' => new self($rpc, 'This method is not available for groups with more than `chat_read_mark_size_threshold` members, [see client configuration »](https://core.telegram.org/api/config#client-configuration).', $code, $caller, $previous),
'CHATLINK_SLUG_EMPTY' => new self($rpc, 'The specified slug is empty.', $code, $caller, $previous),
'CHATLINK_SLUG_EXPIRED' => new self($rpc, 'The specified [business chat link](https://core.telegram.org/api/business#business-chat-links) has expired.', $code, $caller, $previous),
'CHATLINKS_TOO_MUCH' => new self($rpc, 'Too many [business chat links](https://core.telegram.org/api/business#business-chat-links) were created, please delete some older links.', $code, $caller, $previous),
'CHATLIST_EXCLUDE_INVALID' => new self($rpc, 'The specified `exclude_peers` are invalid.', $code, $caller, $previous),
'CODE_EMPTY' => new self($rpc, 'The provided code is empty.', $code, $caller, $previous),
'CODE_HASH_INVALID' => new self($rpc, 'Code hash invalid.', $code, $caller, $previous),
@ -339,6 +356,7 @@ class RPCErrorException extends \Exception
'DOCUMENT_INVALID' => new self($rpc, 'The specified document is invalid.', $code, $caller, $previous),
'EMAIL_HASH_EXPIRED' => new self($rpc, 'Email hash expired.', $code, $caller, $previous),
'EMAIL_INVALID' => new self($rpc, 'The specified email is invalid.', $code, $caller, $previous),
'EMAIL_NOT_ALLOWED' => new self($rpc, 'The specified email cannot be used to complete the operation.', $code, $caller, $previous),
'EMAIL_NOT_SETUP' => new self($rpc, 'In order to change the login email with emailVerifyPurposeLoginChange, an existing login email must already be set using emailVerifyPurposeLoginSetup.', $code, $caller, $previous),
'EMAIL_UNCONFIRMED' => new self($rpc, 'Email unconfirmed.', $code, $caller, $previous),
'EMAIL_VERIFY_EXPIRED' => new self($rpc, 'The verification email has expired.', $code, $caller, $previous),
@ -354,7 +372,7 @@ class RPCErrorException extends \Exception
'ENCRYPTION_DECLINED' => new \danog\MadelineProto\RPCError\EncryptionDeclinedError($code, $caller, $previous),
'ENCRYPTION_ID_INVALID' => new self($rpc, 'The provided secret chat ID is invalid.', $code, $caller, $previous),
'ENTITIES_TOO_LONG' => new self($rpc, 'You provided too many styled message entities.', $code, $caller, $previous),
'ENTITY_BOUNDS_INVALID' => new self($rpc, 'A specified [entity offset or length](/api/entities#entity-length) is invalid, see [here »](/api/entities#entity-length) for info on how to properly compute the entity offset/length.', $code, $caller, $previous),
'ENTITY_BOUNDS_INVALID' => new self($rpc, 'A specified [entity offset or length](https://core.telegram.org/api/entities#entity-length) is invalid, see [here »](https://core.telegram.org/api/entities#entity-length) for info on how to properly compute the entity offset/length.', $code, $caller, $previous),
'ENTITY_MENTION_USER_INVALID' => new self($rpc, 'You mentioned an invalid user.', $code, $caller, $previous),
'ERROR_TEXT_EMPTY' => new self($rpc, 'The provided error message is empty.', $code, $caller, $previous),
'EXPIRE_DATE_INVALID' => new self($rpc, 'The specified expiration date is invalid.', $code, $caller, $previous),
@ -382,6 +400,7 @@ class RPCErrorException extends \Exception
'FIRSTNAME_INVALID' => new self($rpc, 'The first name is invalid.', $code, $caller, $previous),
'FOLDER_ID_EMPTY' => new self($rpc, 'An empty folder ID was specified.', $code, $caller, $previous),
'FOLDER_ID_INVALID' => new self($rpc, 'Invalid folder ID.', $code, $caller, $previous),
'FORM_EXPIRED' => new self($rpc, 'The form was generated more than 10 minutes ago and has expired, please re-generate it using [payments.getPaymentForm](https://core.telegram.org/method/payments.getPaymentForm) and pass the new `form_id`.', $code, $caller, $previous),
'FORUM_ENABLED' => new self($rpc, 'You can\'t execute the specified action because the group is a [forum](https://core.telegram.org/api/forum), disable forum functionality to continue.', $code, $caller, $previous),
'FRESH_CHANGE_ADMINS_FORBIDDEN' => new self($rpc, 'You were just elected admin, you can\'t add or modify other admins yet.', $code, $caller, $previous),
'FROM_MESSAGE_BOT_DISABLED' => new \danog\MadelineProto\RPCError\FromMessageBotDisabledError($code, $caller, $previous),
@ -404,12 +423,13 @@ class RPCErrorException extends \Exception
'GROUPCALL_SSRC_DUPLICATE_MUCH' => new self($rpc, 'The app needs to retry joining the group call with a new SSRC value.', $code, $caller, $previous),
'GROUPED_MEDIA_INVALID' => new self($rpc, 'Invalid grouped media.', $code, $caller, $previous),
'HASH_INVALID' => new self($rpc, 'The provided hash is invalid.', $code, $caller, $previous),
'HASHTAG_INVALID' => new self($rpc, 'The specified hashtag is invalid.', $code, $caller, $previous),
'HIDE_REQUESTER_MISSING' => new self($rpc, 'The join request was missing or was already handled.', $code, $caller, $previous),
'IMAGE_PROCESS_FAILED' => new \danog\MadelineProto\RPCError\ImageProcessFailedError($code, $caller, $previous),
'IMPORT_FILE_INVALID' => new self($rpc, 'The specified chat export file is invalid.', $code, $caller, $previous),
'IMPORT_FORMAT_DATE_INVALID' => new self($rpc, 'The date specified in the import file is invalid.', $code, $caller, $previous),
'IMPORT_FORMAT_UNRECOGNIZED' => new self($rpc, 'The specified chat export file was exported from an unsupported chat app.', $code, $caller, $previous),
'IMPORT_HISTORY_LOG_EMPTY' => new self($rpc, '', $code, $caller, $previous),
'IMPORT_HISTORY_LOG_EMPTY' => new self($rpc, null, $code, $caller, $previous),
'IMPORT_ID_INVALID' => new self($rpc, 'The specified import ID is invalid.', $code, $caller, $previous),
'IMPORT_TOKEN_INVALID' => new self($rpc, 'The specified token is invalid.', $code, $caller, $previous),
'INLINE_RESULT_EXPIRED' => new self($rpc, 'The inline query expired.', $code, $caller, $previous),
@ -426,7 +446,7 @@ class RPCErrorException extends \Exception
'INVITE_REVOKED_MISSING' => new self($rpc, 'The specified invite link was already revoked or is invalid.', $code, $caller, $previous),
'INVITE_SLUG_EMPTY' => new self($rpc, 'The specified invite slug is empty.', $code, $caller, $previous),
'INVITE_SLUG_EXPIRED' => new self($rpc, 'The specified chat folder link has expired.', $code, $caller, $previous),
'INVITES_TOO_MUCH' => new self($rpc, 'The maximum number of per-folder invites specified by the `chatlist_invites_limit_default`/`chatlist_invites_limit_premium` [client configuration parameters »](/api/config#chatlist-invites-limit-default) was reached.', $code, $caller, $previous),
'INVITES_TOO_MUCH' => new self($rpc, 'The maximum number of per-folder invites specified by the `chatlist_invites_limit_default`/`chatlist_invites_limit_premium` [client configuration parameters »](https://core.telegram.org/api/config#chatlist-invites-limit-default) was reached.', $code, $caller, $previous),
'INVOICE_PAYLOAD_INVALID' => new self($rpc, 'The specified invoice payload is invalid.', $code, $caller, $previous),
'JOIN_AS_PEER_INVALID' => new self($rpc, 'The specified peer cannot be used to join a group call.', $code, $caller, $previous),
'LANG_CODE_INVALID' => new self($rpc, 'The specified language code is invalid.', $code, $caller, $previous),
@ -459,6 +479,7 @@ class RPCErrorException extends \Exception
'MESSAGE_ID_INVALID' => new self($rpc, 'The provided message id is invalid.', $code, $caller, $previous),
'MESSAGE_IDS_EMPTY' => new self($rpc, 'No message ids were provided.', $code, $caller, $previous),
'MESSAGE_NOT_MODIFIED' => new self($rpc, 'The provided message data is identical to the previous message data, the message wasn\'t modified.', $code, $caller, $previous),
'MESSAGE_NOT_READ_YET' => new self($rpc, 'The specified message wasn\'t read yet.', $code, $caller, $previous),
'MESSAGE_POLL_CLOSED' => new self($rpc, 'Poll closed.', $code, $caller, $previous),
'MESSAGE_TOO_LONG' => new self($rpc, 'The provided message is too long.', $code, $caller, $previous),
'MESSAGE_TOO_OLD' => new self($rpc, 'The message is too old, the requested information is not available.', $code, $caller, $previous),
@ -488,7 +509,7 @@ class RPCErrorException extends \Exception
'PARTICIPANTS_TOO_FEW' => new self($rpc, 'Not enough participants.', $code, $caller, $previous),
'PASSWORD_EMPTY' => new self($rpc, 'The provided password is empty.', $code, $caller, $previous),
'PASSWORD_HASH_INVALID' => new \danog\MadelineProto\RPCError\PasswordHashInvalidError($code, $caller, $previous),
'PASSWORD_MISSING' => new self($rpc, 'You must enable 2FA in order to transfer ownership of a channel.', $code, $caller, $previous),
'PASSWORD_MISSING' => new self($rpc, 'You must [enable 2FA](https://core.telegram.org/api/srp) before executing this operation.', $code, $caller, $previous),
'PASSWORD_RECOVERY_EXPIRED' => new self($rpc, 'The recovery code has expired.', $code, $caller, $previous),
'PASSWORD_RECOVERY_NA' => new self($rpc, 'No email was set, can\'t recover password via email.', $code, $caller, $previous),
'PASSWORD_REQUIRED' => new self($rpc, 'A [2FA password](https://core.telegram.org/api/srp) must be configured to use Telegram Passport.', $code, $caller, $previous),
@ -538,6 +559,7 @@ class RPCErrorException extends \Exception
'QUERY_ID_EMPTY' => new self($rpc, 'The query ID is empty.', $code, $caller, $previous),
'QUERY_ID_INVALID' => new self($rpc, 'The query ID is invalid.', $code, $caller, $previous),
'QUERY_TOO_SHORT' => new self($rpc, 'The query string is too short.', $code, $caller, $previous),
'QUICK_REPLIES_TOO_MUCH' => new \danog\MadelineProto\RPCError\QuickRepliesTooMuchError($code, $caller, $previous),
'QUIZ_ANSWER_MISSING' => new self($rpc, 'You can forward a quiz while hiding the original author only after choosing an option in the quiz.', $code, $caller, $previous),
'QUIZ_CORRECT_ANSWER_INVALID' => new self($rpc, 'An invalid value was provided to the correct_answers field.', $code, $caller, $previous),
'QUIZ_CORRECT_ANSWERS_EMPTY' => new self($rpc, 'No correct quiz answer was specified.', $code, $caller, $previous),
@ -551,12 +573,14 @@ class RPCErrorException extends \Exception
'RANGES_INVALID' => new self($rpc, 'Invalid range provided.', $code, $caller, $previous),
'REACTION_EMPTY' => new self($rpc, 'Empty reaction provided.', $code, $caller, $previous),
'REACTION_INVALID' => new self($rpc, 'The specified reaction is invalid.', $code, $caller, $previous),
'REACTIONS_TOO_MANY' => new self($rpc, 'The message already has exactly `reactions_uniq_max` reaction emojis, you can\'t react with a new emoji, see [the docs for more info »](/api/config#client-configuration).', $code, $caller, $previous),
'REACTIONS_TOO_MANY' => new self($rpc, 'The message already has exactly `reactions_uniq_max` reaction emojis, you can\'t react with a new emoji, see [the docs for more info »](https://core.telegram.org/api/config#client-configuration).', $code, $caller, $previous),
'RECEIPT_EMPTY' => new self($rpc, 'The specified receipt is empty.', $code, $caller, $previous),
'REPLY_MARKUP_BUY_EMPTY' => new self($rpc, 'Reply markup for buy button empty.', $code, $caller, $previous),
'REPLY_MARKUP_GAME_EMPTY' => new self($rpc, '', $code, $caller, $previous),
'REPLY_MARKUP_GAME_EMPTY' => new self($rpc, null, $code, $caller, $previous),
'REPLY_MARKUP_INVALID' => new self($rpc, 'The provided reply markup is invalid.', $code, $caller, $previous),
'REPLY_MARKUP_TOO_LONG' => new self($rpc, 'The specified reply_markup is too long.', $code, $caller, $previous),
'REPLY_MESSAGE_ID_INVALID' => new self($rpc, 'The specified reply-to message ID is invalid.', $code, $caller, $previous),
'REPLY_MESSAGES_TOO_MUCH' => new \danog\MadelineProto\RPCError\ReplyMessagesTooMuchError($code, $caller, $previous),
'REPLY_TO_INVALID' => new self($rpc, 'The specified `reply_to` field is invalid.', $code, $caller, $previous),
'REPLY_TO_USER_INVALID' => new self($rpc, 'The replied-to user is invalid.', $code, $caller, $previous),
'REQUEST_TOKEN_INVALID' => new \danog\MadelineProto\RPCError\RequestTokenInvalidError($code, $caller, $previous),
@ -568,6 +592,8 @@ class RPCErrorException extends \Exception
'RESULTS_TOO_MUCH' => new self($rpc, 'Too many results were provided.', $code, $caller, $previous),
'REVOTE_NOT_ALLOWED' => new self($rpc, 'You cannot change your vote.', $code, $caller, $previous),
'RIGHTS_NOT_MODIFIED' => new self($rpc, 'The new admin rights are equal to the old rights, no change was made.', $code, $caller, $previous),
'RINGTONE_INVALID' => new self($rpc, 'The specified ringtone is invalid.', $code, $caller, $previous),
'RINGTONE_MIME_INVALID' => new self($rpc, 'The MIME type for the ringtone is invalid.', $code, $caller, $previous),
'RSA_DECRYPT_FAILED' => new self($rpc, 'Internal RSA decryption failed.', $code, $caller, $previous),
'SCHEDULE_BOT_NOT_ALLOWED' => new \danog\MadelineProto\RPCError\ScheduleBotNotAllowedError($code, $caller, $previous),
'SCHEDULE_DATE_INVALID' => new self($rpc, 'Invalid schedule date provided.', $code, $caller, $previous),
@ -578,6 +604,7 @@ class RPCErrorException extends \Exception
'SEARCH_QUERY_EMPTY' => new self($rpc, 'The search query is empty.', $code, $caller, $previous),
'SEARCH_WITH_LINK_NOT_SUPPORTED' => new self($rpc, 'You cannot provide a search query and an invite link at the same time.', $code, $caller, $previous),
'SECONDS_INVALID' => new self($rpc, 'Invalid duration provided.', $code, $caller, $previous),
'SECURE_SECRET_REQUIRED' => new self($rpc, 'A secure secret is required.', $code, $caller, $previous),
'SEND_AS_PEER_INVALID' => new self($rpc, 'You can\'t send messages as the specified peer.', $code, $caller, $previous),
'SEND_MESSAGE_MEDIA_INVALID' => new self($rpc, 'Invalid media provided.', $code, $caller, $previous),
'SEND_MESSAGE_TYPE_INVALID' => new self($rpc, 'The message type is invalid.', $code, $caller, $previous),
@ -617,7 +644,7 @@ class RPCErrorException extends \Exception
'STICKERS_TOO_MUCH' => new self($rpc, 'There are too many stickers in this stickerpack, you can\'t add any more.', $code, $caller, $previous),
'STICKERSET_INVALID' => new self($rpc, 'The provided sticker set is invalid.', $code, $caller, $previous),
'STORIES_NEVER_CREATED' => new self($rpc, 'This peer hasn\'t ever posted any stories.', $code, $caller, $previous),
'STORIES_TOO_MUCH' => new self($rpc, 'You have hit the maximum active stories limit as specified by the [`story_expiring_limit_*` client configuration parameters](https://core.telegram.org/api/config#story-expiring-limit-default): you should buy a [Premium](/api/premium) subscription, delete an active story, or wait for the oldest story to expire.', $code, $caller, $previous),
'STORIES_TOO_MUCH' => new self($rpc, 'You have hit the maximum active stories limit as specified by the [`story_expiring_limit_*` client configuration parameters](https://core.telegram.org/api/config#story-expiring-limit-default): you should buy a [Premium](https://core.telegram.org/api/premium) subscription, delete an active story, or wait for the oldest story to expire.', $code, $caller, $previous),
'STORY_ID_EMPTY' => new self($rpc, 'You specified no story IDs.', $code, $caller, $previous),
'STORY_ID_INVALID' => new self($rpc, 'The specified story ID is invalid.', $code, $caller, $previous),
'STORY_NOT_MODIFIED' => new self($rpc, 'The new story information you passed is equal to the previous story information, thus it wasn\'t modified.', $code, $caller, $previous),
@ -625,7 +652,7 @@ class RPCErrorException extends \Exception
'SWITCH_PM_TEXT_EMPTY' => new self($rpc, 'The switch_pm.text field was empty.', $code, $caller, $previous),
'SWITCH_WEBVIEW_URL_INVALID' => new self($rpc, 'The URL specified in switch_webview.url is invalid!', $code, $caller, $previous),
'TAKEOUT_INVALID' => new self($rpc, 'The specified takeout ID is invalid.', $code, $caller, $previous),
'TAKEOUT_REQUIRED' => new self($rpc, 'A [takeout](https://core.telegram.org/api/takeout) session needs to be initialized first, [see here » for more info](/api/takeout).', $code, $caller, $previous),
'TAKEOUT_REQUIRED' => new self($rpc, 'A [takeout](https://core.telegram.org/api/takeout) session needs to be initialized first, [see here » for more info](https://core.telegram.org/api/takeout).', $code, $caller, $previous),
'TASK_ALREADY_EXISTS' => new self($rpc, 'An email reset was already requested.', $code, $caller, $previous),
'TEMP_AUTH_KEY_ALREADY_BOUND' => new self($rpc, 'The passed temporary key is already bound to another **perm_auth_key_id**.', $code, $caller, $previous),
'TEMP_AUTH_KEY_EMPTY' => new self($rpc, 'No temporary auth key provided.', $code, $caller, $previous),
@ -634,7 +661,7 @@ class RPCErrorException extends \Exception
'THEME_INVALID' => new self($rpc, 'Invalid theme provided.', $code, $caller, $previous),
'THEME_MIME_INVALID' => new self($rpc, 'The theme\'s MIME type is invalid.', $code, $caller, $previous),
'THEME_TITLE_INVALID' => new self($rpc, 'The specified theme title is invalid.', $code, $caller, $previous),
'TIMEZONE_INVALID' => new self($rpc, '', $code, $caller, $previous),
'TIMEZONE_INVALID' => new self($rpc, 'The specified timezone does not exist.', $code, $caller, $previous),
'TITLE_INVALID' => new self($rpc, 'The specified stickerpack title is invalid.', $code, $caller, $previous),
'TMP_PASSWORD_DISABLED' => new self($rpc, 'The temporary password is disabled.', $code, $caller, $previous),
'TO_LANG_INVALID' => new self($rpc, 'The specified destination language is invalid.', $code, $caller, $previous),
@ -650,7 +677,7 @@ class RPCErrorException extends \Exception
'TOPIC_TITLE_EMPTY' => new self($rpc, 'The specified topic title is empty.', $code, $caller, $previous),
'TOPICS_EMPTY' => new self($rpc, 'You specified no topic IDs.', $code, $caller, $previous),
'TRANSCRIPTION_FAILED' => new self($rpc, 'Audio transcription failed.', $code, $caller, $previous),
'TRANSLATE_REQ_QUOTA_EXCEEDED' => new self($rpc, '', $code, $caller, $previous),
'TRANSLATE_REQ_QUOTA_EXCEEDED' => new self($rpc, null, $code, $caller, $previous),
'TTL_DAYS_INVALID' => new self($rpc, 'The provided TTL is invalid.', $code, $caller, $previous),
'TTL_MEDIA_INVALID' => new self($rpc, 'Invalid media Time To Live was provided.', $code, $caller, $previous),
'TTL_PERIOD_INVALID' => new self($rpc, 'The specified TTL period is invalid.', $code, $caller, $previous),
@ -667,7 +694,7 @@ class RPCErrorException extends \Exception
'USER_BOT_INVALID' => new self($rpc, 'User accounts must provide the `bot` method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts.', $code, $caller, $previous),
'USER_BOT_REQUIRED' => new self($rpc, 'This method can only be called by a bot.', $code, $caller, $previous),
'USER_CHANNELS_TOO_MUCH' => new self($rpc, 'One of the users you tried to add is already in too many channels/supergroups.', $code, $caller, $previous),
'USER_CREATOR' => new self($rpc, 'You can\'t leave this channel, because you\'re its creator.', $code, $caller, $previous),
'USER_CREATOR' => new self($rpc, 'For channels.editAdmin: you\'ve tried to edit the admin rights of the owner, but you\'re not the owner; for channels.leaveChannel: you can\'t leave this channel, because you\'re its creator.', $code, $caller, $previous),
'USER_ID_INVALID' => new self($rpc, 'The provided user ID is invalid.', $code, $caller, $previous),
'USER_INVALID' => new self($rpc, 'Invalid user provided.', $code, $caller, $previous),
'USER_IS_BLOCKED' => new \danog\MadelineProto\RPCError\UserIsBlockedError($code, $caller, $previous),
@ -710,15 +737,12 @@ class RPCErrorException extends \Exception
'WEBPUSH_KEY_INVALID' => new self($rpc, 'The specified web push elliptic curve Diffie-Hellman public key is invalid.', $code, $caller, $previous),
'WEBPUSH_TOKEN_INVALID' => new self($rpc, 'The specified web push token is invalid.', $code, $caller, $previous),
'YOU_BLOCKED_USER' => new \danog\MadelineProto\RPCError\YouBlockedUserError($code, $caller, $previous),
'BOT_GAMES_DISABLED' => new self($rpc, '', $code, $caller, $previous),
'BOT_METHOD_INVALID' => new self($rpc, 'The specified method cannot be used by bots.', $code, $caller, $previous),
'BOT_POLLS_DISABLED' => new self($rpc, '', $code, $caller, $previous),
'CONNECTION_DEVICE_MODEL_EMPTY' => new self($rpc, 'The specified device model is empty.', $code, $caller, $previous),
'CONNECTION_LANG_PACK_INVALID' => new self($rpc, 'The specified language pack is empty.', $code, $caller, $previous),
'CONNECTION_NOT_INITED' => new self($rpc, 'Please initialize the connection using initConnection before making queries.', $code, $caller, $previous),
'CONNECTION_SYSTEM_EMPTY' => new self($rpc, 'The specified system version is empty.', $code, $caller, $previous),
'CONNECTION_SYSTEM_LANG_CODE_EMPTY' => new self($rpc, 'The specified system language code is empty.', $code, $caller, $previous),
'GROUP_CALL_INVALID' => new self($rpc, '', $code, $caller, $previous),
'INPUT_CONSTRUCTOR_INVALID' => new self($rpc, 'The specified TL constructor is invalid.', $code, $caller, $previous),
'INPUT_FETCH_ERROR' => new self($rpc, 'An error occurred while parsing the provided TL constructor.', $code, $caller, $previous),
'INPUT_FETCH_FAIL' => new self($rpc, 'An error occurred while parsing the provided TL constructor.', $code, $caller, $previous),
@ -726,13 +750,13 @@ class RPCErrorException extends \Exception
'INPUT_METHOD_INVALID' => new self($rpc, 'The specified method is invalid.', $code, $caller, $previous),
'INPUT_REQUEST_TOO_LONG' => new self($rpc, 'The request payload is too long.', $code, $caller, $previous),
'PEER_FLOOD' => new self($rpc, 'The current account is spamreported, you cannot execute this action, check @spambot for more info.', $code, $caller, $previous),
'PHOTO_THUMB_URL_INVALID' => new self($rpc, '', $code, $caller, $previous),
'STICKERSET_NOT_MODIFIED' => new self($rpc, '', $code, $caller, $previous),
'STICKERSET_NOT_MODIFIED' => new self($rpc, 'The passed stickerset information is equal to the current information.', $code, $caller, $previous),
'TMP_PASSWORD_INVALID' => new self($rpc, 'The passed tmp_password is invalid.', $code, $caller, $previous),
'WEBDOCUMENT_URL_EMPTY' => new self($rpc, 'The passed web document URL is empty.', $code, $caller, $previous),
'ANONYMOUS_REACTIONS_DISABLED' => new self($rpc, 'Sorry, anonymous administrators cannot leave reactions or participate in polls.', $code, $caller, $previous),
'BROADCAST_FORBIDDEN' => new self($rpc, 'Channel poll voters and reactions cannot be fetched to prevent deanonymization.', $code, $caller, $previous),
'CHANNEL_PUBLIC_GROUP_NA' => new self($rpc, 'channel/supergroup not available.', $code, $caller, $previous),
'CHAT_ACTION_FORBIDDEN' => new self($rpc, 'You cannot execute this action.', $code, $caller, $previous),
'CHAT_ADMIN_INVITE_REQUIRED' => new self($rpc, 'You do not have the rights to do this.', $code, $caller, $previous),
'CHAT_GUEST_SEND_FORBIDDEN' => new \danog\MadelineProto\RPCError\ChatGuestSendForbiddenError($code, $caller, $previous),
'CHAT_SEND_AUDIOS_FORBIDDEN' => new \danog\MadelineProto\RPCError\ChatSendAudiosForbiddenError($code, $caller, $previous),
@ -763,6 +787,7 @@ class RPCErrorException extends \Exception
'USER_RESTRICTED' => new self($rpc, 'You\'re spamreported, you can\'t create channels or chats.', $code, $caller, $previous),
'YOUR_PRIVACY_RESTRICTED' => new self($rpc, 'You cannot fetch the read date of this message because you have disallowed other users to do so for *your* messages; to fix, allow other users to see *your* exact last online date OR purchase a [Telegram Premium](https://core.telegram.org/api/premium) subscription.', $code, $caller, $previous),
'CHAT_FORBIDDEN' => new \danog\MadelineProto\RPCError\ChatForbiddenError($code, $caller, $previous),
'BUSINESS_ADDRESS_ACTIVE' => new self($rpc, 'The user is currently advertising a [Business Location](https://core.telegram.org/api/business#location), the location may only be changed (or removed) using [account.updateBusinessLocation »](https://core.telegram.org/method/account.updateBusinessLocation). .', $code, $caller, $previous),
'CALL_PROTOCOL_COMPAT_LAYER_INVALID' => new self($rpc, 'The other side of the call does not support any of the VoIP protocols supported by the local client, as specified by the `protocol.layer` and `protocol.library_versions` fields.', $code, $caller, $previous),
'FILEREF_UPGRADE_NEEDED' => new self($rpc, 'The client has to be updated in order to support [file references](https://core.telegram.org/api/file_reference).', $code, $caller, $previous),
'FRESH_CHANGE_PHONE_FORBIDDEN' => new self($rpc, 'You can\'t change phone number right after logging in, please wait at least 24 hours.', $code, $caller, $previous),
@ -774,7 +799,6 @@ class RPCErrorException extends \Exception
'UPDATE_APP_TO_LOGIN' => new self($rpc, 'Please update to the latest version of MadelineProto to login.', $code, $caller, $previous),
'USERPIC_PRIVACY_REQUIRED' => new self($rpc, 'You need to disable privacy settings for your profile picture in order to make your geolocation public.', $code, $caller, $previous),
'AUTH_KEY_DUPLICATED' => new self($rpc, 'Concurrent usage of the current session from multiple connections was detected, the current session was invalidated by the server for security reasons!', $code, $caller, $previous),
'ACTIVE_USER_REQUIRED' => new self($rpc, '', $code, $caller, $previous),
'AUTH_KEY_INVALID' => new self($rpc, 'The specified auth key is invalid.', $code, $caller, $previous),
'AUTH_KEY_PERM_EMPTY' => new self($rpc, 'The method is unavailable for temporary authorization keys, not bound to a permanent authorization key.', $code, $caller, $previous),
'AUTH_KEY_UNREGISTERED' => new self($rpc, 'The specified authorization key is not registered in the system (for example, a PFS temporary key has expired).', $code, $caller, $previous),