150 Commits

Author SHA1 Message Date
Alex b0d87b80b0 Sync Laravel library 1.7.0 2026-10-01 13:02:21 +03:00
Alex 21f6cb9e83 Update tests and Throw InvalidArgumentException when building an empty comment body 2026-10-01 11:26:19 +03:00
Alex 093fafaff4 Merge pull request #44 from smotim/sync/api-schema-0.0.33
feat: sync with Bot API schema 0.0.33
2026-10-01 10:33:10 +03:00
Alex 591be47cc2 Merge branch 'master' into sync/api-schema-0.0.33 2026-10-01 10:32:49 +03:00
Alex fd878a45e7 Merge pull request #43 from smotim/fix/me-commands
feat: add editBotCommands for PATCH /me/commands, deprecate editBotInfo
2026-10-01 08:33:26 +03:00
Alex 919970fa20 Convert non-array update payloads to LogicException instead of TypeError 2026-09-30 23:40:03 +03:00
Timofey dd00b4c5e6 Allow comment_removed without post_id
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.
2026-10-01 01:10:45 +05:00
Timofey d9ec52fc53 Add disableLinkPreview to answerOnCallback
POST /answers got the disable_link_preview query parameter in August
2026. It is sent only when true, so default requests are unchanged.
2026-10-01 01:10:45 +05:00
Timofey 96dea75530 Deprecate what the API no longer has
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.
2026-10-01 01:10:45 +05:00
Timofey c8f3b8e33d Add comments API
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.
2026-10-01 01:10:45 +05:00
Timofey 1bfeb17a15 Add fields and markup added in schema 0.0.33
- 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.
2026-10-01 01:10:45 +05:00
Timofey d1637add72 Parse comment and bot admin permission updates
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.
2026-10-01 01:10:45 +05:00
Timofey 749c0aab5b Allow users without last_activity_time
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 #6 ($lastActivityTime)
must be of type int, null given" and took the whole update with it.
2026-10-01 01:10:28 +05:00
Timofey 90fa4a76dc Sync bundled OpenAPI schema with the official one (0.0.33)
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.
2026-10-01 01:10:28 +05:00
Timofey ca5ed4c100 Add editBotCommands for PATCH /me/commands, deprecate editBotInfo
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
2026-10-01 01:10:28 +05:00
Alex bf5219af7a Merge pull request #45 from smotim/fix/unparseable-updates
fix: skip updates that do not fit their model instead of crashing
2026-09-30 23:03:19 +03:00
Timofey a50e5be823 Skip updates that do not fit their model instead of crashing
#17 made unsupported update types silent: createUpdate() throws a
LogicException, and createUpdateList() and WebhookHandler log it and
skip the update. An update of a known type whose payload no longer
fits the model (the API made a field optional, added an enum value)
fails earlier, with a TypeError or ValueError from the model
constructor, and nothing catches those:

- createUpdateList() lets it out of getUpdates(), and
  LongPollingHandler::handle() catches only \Exception, so the loop
  stops and restarts into the same batch
- WebhookHandler answers 500 and MAX keeps retrying

createUpdate() now turns TypeError and ValueError into a
LogicException (the original one kept as previous) and logs a warning
with the payload, so the existing silent mode skips such an update.
Errors thrown by user handlers are not affected.
2026-09-28 00:34:08 +05:00
Timofey e431046a1a Add editBotCommands for PATCH /me/commands, deprecate editBotInfo
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
2026-09-28 00:08:35 +05:00
Alex 9bfe60a3a2 Merge pull request #42 from spyke113/master
New update types
1.6.7
2026-09-11 08:56:39 +03:00
Semion Zuev d1351ab21b Merge branch 'BushlanovDev:master' into master 2026-09-09 14:53:36 +03:00
szuev 93169320f7 new update types 2026-09-09 14:51:50 +03:00
Alex 4516db5ffd Refactoring base url #38 1.6.6 2026-07-26 12:56:32 +03:00
Alex a35e1a22ad Merge pull request #40 from alexeipanov/fix/permissions
Add new chat admin permission constants
2026-07-25 22:46:21 +03:00
Alexei Panov caecb3f444 add new chat admin permission constants 2026-07-22 23:08:31 +04:00
Alex 10a7ef1ef8 tag 1.6.5 1.6.5 2026-07-19 09:29:19 +03:00
Alex f5d545715f Merge pull request #39 from yakoffka/patch-1
Change url address
2026-07-19 09:26:25 +03:00
yakoffKa 865eb56aca Change url address 2026-07-17 09:49:59 +03:00
Alex f788038189 Update doc 2026-07-05 13:57:03 +03:00
Alex 22b328b0c3 Update doc 2026-07-02 22:32:39 +03:00
Alex daa3d297da Update doc 2026-07-02 22:19:34 +03:00
Alex a40e47ebc0 Update doc 2026-07-02 22:17:38 +03:00
Alex 99f66483f3 Update doc 2026-07-02 22:13:24 +03:00
Alex e5a6ec40fc Update composer 1.6.4 2026-06-27 16:40:46 +03:00
Alex 9eb8783f40 Merge pull request #36 from tofers/patch-1
Change url address
2026-06-27 09:38:23 +03:00
Konstantin 40de64593b Change url address
Для корректной работы ваших чат-ботов и мини-приложений до 19 июля 2026 необходимо перенаправить HTTP-запросы с домена platform-api.max.ru на platform-api2.max.ru, а также добавить сертификат Минцифры в список доверенных
2026-06-25 12:53:49 +03:00
Alex dfe2147cd1 tag 1.6.3 1.6.3 2026-04-26 20:36:38 +03:00
Alex 3d958f3f92 Update tests 2026-04-26 20:28:07 +03:00
Alex f40dc12d0c Merge pull request #32 from imperiumbee/master
New button type clipboard
2026-04-26 19:04:43 +03:00
imperiumbee b726c96366 Merge branch 'BushlanovDev:master' into master 2026-04-25 18:41:05 +03:00
imperiumbee c41221cec7 New button type clipboard 2026-04-25 18:38:55 +03:00
Alex 4fdfca53ee tag 1.6.2 1.6.2 2026-04-17 20:21:29 +03:00
Alex 9df8ed8817 Merge pull request #31 from spyke113/master
add `psr/log` versions
2026-04-16 14:46:34 +03:00
szuev 455b36ba2a add psr/log versions 2026-04-16 13:05:58 +03:00
Alex efd6261490 Added chat admin permissions 1.6.1 2026-04-15 22:10:15 +03:00
Alex dd295efc3d tag 1.6.0 1.6.0 2026-03-22 09:23:35 +03:00
Alex 85231b0962 Removed deprecated DataAttachment 2026-03-21 09:44:40 +03:00
Alex 40742ddc60 Removed deprecated ReplyKeyboardAttachment #27 2026-03-20 22:55:36 +03:00
Alex 1e48123ee3 Updated webhook documentation #26 2026-03-13 20:54:49 +03:00
Alex affe904bed tag 1.5.1 1.5.1 2026-03-07 09:47:01 +03:00
Alex 6c4e0c8ca7 Merge pull request #24 from imperiumbee/master
Added payload param to openAppButton
2026-03-07 09:25:53 +03:00