From 6bf45181dbbaca305f74470011785f5bebc2c9e3 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 8 Sep 2023 11:53:54 +0200 Subject: [PATCH] Add nghttp2 to docker image, fix issue with messages.sendMedia --- src/API.php | 2 +- src/MTProtoTools/FilesLogic.php | 2 +- tests/dockerfiles/Dockerfile.alpine | 2 +- tests/testing.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/API.php b/src/API.php index 02645342c..a63315863 100644 --- a/src/API.php +++ b/src/API.php @@ -51,7 +51,7 @@ final class API extends AbstractAPI * * @var string */ - public const RELEASE = '8.0.0-beta148'; + public const RELEASE = '8.0.0-beta149'; /** * Secret chat was not found. * diff --git a/src/MTProtoTools/FilesLogic.php b/src/MTProtoTools/FilesLogic.php index cd56539a7..ca8e44480 100644 --- a/src/MTProtoTools/FilesLogic.php +++ b/src/MTProtoTools/FilesLogic.php @@ -290,7 +290,7 @@ trait FilesLogic 'application/octet-stream' ); } - if ($upload) { + if ($upload && !\is_array($media['file'])) { $media['file'] = $this->upload($media['file']); } } diff --git a/tests/dockerfiles/Dockerfile.alpine b/tests/dockerfiles/Dockerfile.alpine index 7e9aee190..2a63770c1 100644 --- a/tests/dockerfiles/Dockerfile.alpine +++ b/tests/dockerfiles/Dockerfile.alpine @@ -15,7 +15,7 @@ RUN chmod +x /usr/local/bin/install-php-extensions && \ install-php-extensions pcntl uv-beta ffi pq memprof intl gmp mbstring pdo_mysql xml dom iconv zip opcache igbinary && \ rm /usr/local/bin/install-php-extensions -RUN apk add ffmpeg +RUN apk add ffmpeg nghttp2 ADD ./tests/dockerfiles/php.ini /usr/local/etc/php/php.ini diff --git a/tests/testing.php b/tests/testing.php index 37d3fb26c..874d895f5 100755 --- a/tests/testing.php +++ b/tests/testing.php @@ -299,7 +299,7 @@ function sendMedia(API $MadelineProto, array $media, string $message, string $me $medias = [ 'base' => $media ]; - /*if (isset($media['file']) && is_string($media['file'])) { + if (isset($media['file']) && is_string($media['file'])) { $MadelineProto->sendDocument( peer: $peer, file: new ReadableBuffer(read($media['file'])), @@ -323,7 +323,7 @@ function sendMedia(API $MadelineProto, array $media, string $message, string $me $media, ['url' => new FileCallback($media['url'], fn ($v) => $MadelineProto->logger(...))] ); - }*/ + } foreach ($medias as $subtype => $m) { $MadelineProto->logger("Sending $type $subtype"); $dl = $MadelineProto->extractMessage($MadelineProto->messages->sendMedia(['peer' => $peer, 'media' => $m, 'message' => '['.$message.'](mention:'.$mention.')', 'parse_mode' => 'markdown']));