feat: sync with Bot API schema 0.0.33 - #44
Merged
Merged
Conversation
The API no longer accepts PATCH /me: it answers "Path /me is not recognized", so editBotInfo() fails, including for commands. Commands now have their own endpoint, PATCH /me/commands (editMyCommands in the official schema); bot name, description and photo are edited on the MAX partner platform. - Api::editBotCommands(BotCommand[]): BotCommandsInfo - BotCommandsInfo model and ModelFactory::createBotCommandsInfo() - editBotInfo() and BotPatch marked @deprecated - README coverage map and docs updated
docs/schema.yaml is copied from github.com/max-messenger/api-schema (1a4a502, 2026-09-18); docs/swagger.json is the same schema converted to JSON. The previous copies were 0.0.6 and 0.0.1.
Since schema 0.0.33 User.last_activity_time is nullable and not required. AbstractUser and its subclasses declared it as int, so a user object without it failed with "Argument BushlanovDev#6 ($lastActivityTime) must be of type int, null given" and took the whole update with it.
UpdateType already had comment_created, comment_edited, comment_removed and bot_admin_permissions_changed, but ModelFactory had no models for them and threw "Unknown or unsupported update type". Adds the models from schema 0.0.33, maps them in createUpdate() and adds on*() shortcuts to UpdateDispatcher and MaxBotManager.
- Recipient::$postId: the commented post, set for comments - ContactAttachmentPayload::$hash: hash of the VCF info - ChatPatch: document the description field (up to 16000 chars, empty string removes it) - QuoteMarkup and MarkupType::Quote. createMarkupElement() threw "Unknown or unsupported markup type" on a quote block, so a message with a quote could not be parsed at all New constructor parameters are optional and last, so existing positional calls keep working; toArray() of these models now also carries the new keys.
Schema 0.0.33 adds comments to channel posts:
- GET /messages/{messageId}/comments getComments()
- GET /messages/{messageId}/comments/{commentId} getCommentById()
- POST /messages/{messageId}/comments sendComment()
- PUT /messages/{messageId}/comments editComment()
- DELETE /messages/{messageId}/comments deleteComment()
Comments get their own models (CommentMessage, CommentMessageBody,
CommentLinkedMessage): unlike Message they have no attachments and
no public URL. README coverage map and docs updated.
Methods (per the API changelog and schema 0.0.33):
- getChats(): GET /chats is not supported since June 2026
- getChatByLink(), deleteChat(): no longer documented, absent from
the schema
- addMembers(): POST /chats/{chatId}/members is limited since
9 September 2026 and removed on 30 September 2026
Models and enums absent from schema 0.0.33: the chat inline button,
reply buttons and ReplyButtonType, Intent, MessageChatCreatedUpdate
and its handlers, Chat::$chatMessageId.
Only @deprecated tags and docs; nothing is removed, so existing code
keeps working until a major release. README coverage map updated.
POST /answers got the disable_link_preview query parameter in August 2026. It is sent only when true, so default requests are unchanged.
The schema lists post_id as required, but the official TypeScript client types it as `string | null`. A null would fail with a TypeError and, unlike an unknown update type, TypeError is not caught while parsing updates.
smotim
force-pushed
the
sync/api-schema-0.0.33
branch
from
September 30, 2026 20:11
1ec5b06 to
dd00b4c
Compare
BushlanovDev
self-requested a review
October 1, 2026 05:43
BushlanovDev
added a commit
that referenced
this pull request
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Сверил библиотеку с официальной OpenAPI-схемой MAX — max-messenger/api-schema, версия 0.0.33 от 17.09.2026, — и с changelog API. Копия схемы в
docs/была версии 0.0.6, заменил её на официальную.Ветка основана на #43 (
editBotCommands): пока он не влит, его коммит виден и здесь.Исправления
lastActivityTimeможет отсутствовать. В 0.0.33User.last_activity_timeнеобязательный. Сейчас пользователь без него падает сTypeError: Argument #6 ($lastActivityTime) must be of type int, null given, а вместе с ним теряется всё событие.AbstractUser::$lastActivityTimeстал?int.comment_created,comment_edited,comment_removed,bot_admin_permissions_changed. Они уже были вUpdateType, ноModelFactory::createUpdate()бросал на них «Unknown or unsupported update type». Добавил модели, маппинг иon*()вUpdateDispatcherиMaxBotManager.quote.createMarkupElement()бросал «Unknown or unsupported markup type», и сообщение с цитатой не разбиралось. ДобавилQuoteMarkupиMarkupType::Quote.Новое
getComments,getCommentById,sendComment,editComment,deleteComment. МоделиCommentMessage,CommentMessageBody,CommentLinkedMessage: у комментария нет вложений и публичной ссылки.Recipient::$postId,ContactAttachmentPayload::$hash,descriptionв докблокеChatPatch.disableLinkPreviewвanswerOnCallback: параметрPOST /answersс августа 2026. Уходит только приtrue, запросы по умолчанию не меняются.Deprecated, ничего не удалено
getChats:GET /chatsне поддерживается с июня 2026.getChatByLink,deleteChat: этих методов нет ни в документации, ни в схеме.addMembers:POST /chats/{chatId}/membersограничен с 9 сентября и удаляется 30 сентября 2026.chat, reply-кнопки иReplyButtonType,Intent,MessageChatCreatedUpdate,Chat::$chatMessageId.Совместимость
Новые параметры конструкторов необязательные и стоят последними, так что позиционные вызовы не ломаются.
toArray()уRecipientиContactAttachmentPayloadтеперь содержитpost_idиhash, поэтому в двух тестах поправлены ожидаемые массивы.Как проверял
--coverage-textосталось 100% на PHP 8.4 и 8.5.post_idуcomment_removedобъявлен какstring | null, поэтому поле nullable, хотя в схеме оно обязательное.stabs/*comment*.json) разбираются без ошибок.bot_admin_permissions_changedописан только в схеме: ни один официальный клиент его пока не реализует.Не трогал:
message_deliveredиmessage_read(их нет в схеме, но они добавлены в #42) иLIBRARY_VERSION.