0

Good day to all, please help me understand what the problem is!

I'm trying to send Album to telegram via Madeline's library

Here is my code:

        $telegram->sendMediaGroup([
            'chat_id' => '-1001396042418',
            'media' =>
                [
                [
                      "type" => "photo",
                      "media" => new InputFile('/var/www/madeline/tmp/x-file.jpg', '314441'),
                      "caption" =>  "an optional description of the first photo"
                ],
                [
                    "type" => "photo",
                    "media" => new InputFile('/var/www/madeline/tmp/x-file.jpg', '314441'),
                    "caption" =>  "an optional description of the first photo"
                ],
            ],
        ]);

And I always get an error like:

A path to local file, a URL, or a file resource should be uploaded using `Telegram\Bot\FileUpload\InputFile::create($pathOrUrlOrResource, $filename)` for `media` property. Please view docs for example. [/var/www/vendor/irazasyed/telegram-bot-sdk/src/Exceptions/CouldNotUploadInputFile.php:52]

tell me what I'm doing wrong at the moment

1 Answers1

0

Please Go to telegram-bot-sdk/src/Traits/Http.php

Edit Line number 343 Replace This code

if ((! $params[$inputFileField] instanceof InputFile) && (is_string($params[$inputFileField]) && ! $this->is_json($params[$inputFileField]))) {

I think the problem is with logic building

The Or ( || ) Operation should be replace with and (&&) Operation

This solved my problem.

Istiake
  • 41
  • 1
  • 7