Создай отдельную команду, наследника от SystemCommand, в ней обрабатываю значение кнопки.
<?php
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Request;
class CallbackQueryCommand extends SystemCommand
{
protected $name = 'callbackquery';
protected $description = '';
protected $version = '1.0.0';
public function execute(): ServerResponse
{
$callback_query = $this->getUpdate()->getCallbackQuery();
// Значение кнопки
$callback_data = $callback_query->getData();
return Request::editMessageCaption([
'chat_id' => ,
'message_id' => ,
'caption' => ,
'reply_markup' => ,
]);
}
}