81 Commits

Author SHA1 Message Date
Alex b0d87b80b0 Sync Laravel library 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 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 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 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
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 4516db5ffd Refactoring base url #38 2026-07-26 12:56:32 +03:00
Alex 3d958f3f92 Update tests 2026-04-26 20:28:07 +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 efd6261490 Added chat admin permissions 2026-04-15 22:10:15 +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
imperiumbee 3eb3e07bfa Added payload param to openAppButton 2026-03-06 11:12:20 +03:00
Alex 67463a6b64 Replacing the User object with UserWithPhoto #22 2025-12-19 13:30:36 +03:00
Alex 3c6da8e8f6 Added MessageButton & ChatAdminPermission::EditLink & alias in ChatAdmin & participants in Chat & first_name in BotPatch 2025-12-18 19:50:58 +03:00
Alex a7773c0b93 Added AttachmentNotReadyException (#19) 2025-12-06 15:15:39 +03:00
Alex 79d406da27 ShareAttachmentRequestPayload & PhotoAttachmentRequestPayload update exception rule (#18) 2025-12-05 13:53:07 +03:00
Alex 2e7e9d987f Added DialogUnmuted & DialogCleared & DialogRemoved update types 2025-12-03 23:05:09 +03:00
Alex cf415b70e9 Added DialogMuted & BotStopped update types 2025-12-02 20:00:34 +03:00
Alex a94dfe0df4 Silent mode for errors of unsupported event types #15 2025-12-01 20:11:47 +03:00
Alex da7a07145b Fix send message response object 2025-10-20 21:27:54 +03:00
Alex 7cdbfc0f47 Update Message model 2025-10-08 23:14:06 +03:00
Alex 0dc10bd279 Fix authorization with header #10 2025-10-04 21:51:14 +03:00
Alex ddc57d7ab8 Change api domain and authorization with header 2025-09-29 19:28:20 +03:00
Alex 4d56119fa2 Disable deprecation error for unit test 2025-09-13 19:53:43 +03:00
Alex ae53f51854 Disable deprecation error for unit test 2025-09-13 19:26:13 +03:00
Alex 94ec907506 Added resumable upload tests 2025-08-27 21:26:33 +03:00
Alex cb8ad3f738 Added resumable upload tests 2025-08-26 21:08:07 +03:00
Alex 0f007bf94e Added resumable upload tests 2025-08-26 20:55:45 +03:00
Alex 3127f86c54 Added resumable upload 2025-08-25 23:11:06 +03:00
Alex 92c8f4cd94 Fix upload files 2025-08-20 23:22:18 +03:00
Alex de3a67bee7 Documentation & rename deleteAdmins to deleteAdmin 2025-08-17 22:40:21 +03:00
Alex 00da3af39d Documentation and some fix 2025-08-15 20:17:30 +03:00
Alex 0bb13b3a7c release 1.0.0 2025-08-13 22:00:54 +03:00
Alex 17acd6de67 Laravel support tests 2025-08-12 22:18:20 +03:00
Alex b37e7b6a73 Laravel support tests 2025-08-11 20:48:04 +03:00
Alex 9d56be2c92 Refactoring LongPollingHandler 2025-08-09 18:28:24 +03:00
Alex 9cd5dd2c48 Refactoring update dispatchers 2025-08-08 22:51:35 +03:00
Alex ca13096ec2 Added PSR LoggerInterface 2025-08-07 19:04:07 +03:00
Alex 68da594f89 Added OpenAppButton factory method 2025-08-06 20:52:37 +03:00
Alex 97d016055f fix #2 Error: Cannot instantiate abstract class AbstractAttachment после отправки номера телефона 2025-08-05 18:15:34 +03:00