Skip to content

Fix API parameter handling and improve onCommand handling#2

Merged
antonkomarev merged 1 commit into
masterfrom
fix-api-params-and-add-tests
Mar 22, 2026
Merged

Fix API parameter handling and improve onCommand handling#2
antonkomarev merged 1 commit into
masterfrom
fix-api-params-and-add-tests

Conversation

@antonkomarev
Copy link
Copy Markdown
Member

@antonkomarev antonkomarev commented Mar 21, 2026

Breaking Changes

  • Rename HttpClient::post()postMultipart() for clarity
  • Make Keyboard::$rows private (was accidentally public)

Bug Fixes

  • Fix json_encode of nullable params (forwardMsgId, inlineKeyboardMarkup) — previously encoded null as "null" string instead of being filtered out
  • Remove !== 'null' workaround in filterParams, now redundant after null-check fix
  • Fix BotEventListener command matching — prevent /start from matching /startGame (now requires exact match, space, or @ after command)

Features

  • Add cursor parameter to ChatsApi::getMembers()
  • Add onException callback to BotEventListener::listen() — allows handling exceptions from event handlers without stopping the polling loop
  • Prevent duplicate command handler registration in BotEventListener::onCommand() — throws InvalidArgumentException if already registered

Tests

  • Add unit tests for MessagesApi, ChatsApi, EventsApi — covers parameter formation, fileId/filePath branching, parseMode defaults and overrides
  • Add tests for onException behavior in BotEventListener
  • Extract shared HttpClientSpy test helper to test/Spy/

@antonkomarev antonkomarev force-pushed the fix-api-params-and-add-tests branch from 491b91b to 4aa9b1e Compare March 22, 2026 07:53
@antonkomarev antonkomarev changed the title Fix API parameter handling and add unit tests for API classes Fix API parameter handling and improve onCommand handling Mar 22, 2026
@antonkomarev antonkomarev merged commit 9d25131 into master Mar 22, 2026
12 checks passed
@antonkomarev antonkomarev deleted the fix-api-params-and-add-tests branch March 22, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant