Skip to content

Некорректно работает editMessage #13

Description

@catthecreator

Я пытаюсь выполнить такую логику:

    $r = $api->sendMessage(
      userId: 123,
      text: "Выполняется загрузка файла, подождите",
    )

Затем

    $api->editMessage("mid.00000000013782090199bf5fa5874709",
      text: null,
      attachments: [
        PhotoAttachmentRequest::fromUrl("..."),
    ]);

Значение null не применяется. Файл добавляется к редактируемому сообщению.
Если передать другой текст - все работает.

Я думал что проблема в
vendor/bushlanov-dev/max-bot-api-client-php/src/Api.php -> buildNewMessageBody (1203 строка)

заменил конструкцию на

        $body = array_filter($body, fn($item) => $item !== null);
        $body["text"] = null;
        return $body;

Результат такой же. В http клиент приходит null, но текст не удаляется.
Может, null'овые значения удаляет сам http-клиент?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions