Telegram-bot-sdk: sendMediaGroup()

Created on 4 May 2020  ·  14Comments  ·  Source: irazasyed/telegram-bot-sdk

Hi, i want send a group of photos or videos as an album.
But your method not working:

$media = [];
$media[] = [
    'type'  => 'photo',
    'media' => InputFile::create('https://example.com/file1.jpg')
];

$media[] = [
    'type'  => 'photo',
    'media' => InputFile::create('https://example.com/file2.jpg')
];

$media[] = [
    'type'  => 'video',
    'media' => InputFile::create('https://example.com/file.mp4')
];

$param = [
    'chat_id'   =>  $chat_id,
    'media'     => $media
];
Telegram::sendMediaGroup($param);

Laravel => 7.9
SDK => 3.0.0

Maybe I made a mistake?
Please, help me!

Most helpful comment

@foremtehan

Ah its very simple. We are on the cusp of a MASSIVE new release of the SDK. With some INSANE cool features. But Covid-19 managed to cause a lot of delay with lockdowns and people close to us affected.

So we are just trying to deal with that and finish off the documentation.

I can promise you it is worth the wait though.

All 14 comments

@irazasyed please, answer me

I'll look into this shortly.

@jonnywilliamson Error debug:

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.

But InputFile::create() is used.

We're in the process of a big announcement very very shortly. This issue will be dealt with very soon if you could please just bare with us a little longer. It'll be worth the wait.

Yes, sure. I'm wait :) Thanks!

interested in this as well

i am waiting too :)

Hey. I don’t know if my decision is right, but the following helped me:

$inputMediaPhoto = [ 'type' => 'photo', 'media' => '...', 'parse_mode' => 'HTML' ]; $inputMediaPhoto = \GuzzleHttp\json_encode($inputMediaPhoto);

I hope you get the point.

It does not working for me at all.

@s11e08 tell me please, what did you use for media in your example? Local path, URL or resource?

It does not working for me at all.

@s11e08 tell me please, what did you use for media in your example? Local path, URL or resource?

Я поторопился с ответом в эту тему, извини. Этот способ действительно помог мне с методом editMessageMedia, в качестве media я использовал file_id. Но сейчас проверил на sendMediaGroup и словил ошибку. Надеюсь новая версия библиотеки с фиксом всех багов выйдет скоро

Решил кто то вопрос?

     $arr = [];
        foreach ($array as $item){
            $arr[] = InputMediaPhoto::make([
                "media"=> InputFile::create($item->url),
                "caption"=>$text,
            ]);
        }    
        $add = Telegram::sendMediaGroup([
            "chat_id"=>$cid,
            "media"=>$arr,
        ]);

И пишет ошибку
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.

@irazasyed please, answer me

big announcement very very shortly

@jonnywilliamson any update on this ? i cannot use this method

@foremtehan

Ah its very simple. We are on the cusp of a MASSIVE new release of the SDK. With some INSANE cool features. But Covid-19 managed to cause a lot of delay with lockdowns and people close to us affected.

So we are just trying to deal with that and finish off the documentation.

I can promise you it is worth the wait though.

@foremtehan

Ah its very simple. We are on the cusp of a MASSIVE new release of the SDK. With some INSANE cool features. But Covid-19 managed to cause a lot of delay with lockdowns and people close to us affected.

So we are just trying to deal with that and finish off the documentation.

I can promise you it is worth the wait though.

Its now? Ok?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wlinh picture wlinh  ·  3Comments

jahanzaibbahadur picture jahanzaibbahadur  ·  4Comments

YaroslavStrigun picture YaroslavStrigun  ·  4Comments

iMohammadd picture iMohammadd  ·  3Comments

dswtech picture dswtech  ·  4Comments