Open MrDarkest opened 4 years ago
3.5.0
EditMessageMedia method doesn't work.
I've tried with this code:
$editMessageMedia = new EditMessageMedia(); $editMessageMedia->chat_id = "@channelname" $editMessageMedia->message_id = $message_id; $photo = new Photo(); $photo->media = "https://my-host/image.png" $photo->caption = "A caption"; $photo->parse_mode = "Markdown"; $editMessageMedia->media = $photo; $promise = $tgLog->performApiRequest($editMessageMedia); $promise->then( function () { }, function (\Exception $exception) { error_log($exception->getMessage()); } ); $loop->run();
But it always fails with the error: "Bad Request: can't parse InputMedia: Media is not specified".
With the same parameters the classic POST call to telegram api with a JSON body works fine.
$boturl = "https://api.telegram.org/bot".TELEGRAM_BOT_KEY."/editMessageMedia"; $bodyobj = ["chat_id" => $chat_id, "message_id" => $message_id, "media" => ["type" => "photo", "media" => $url, "caption" => $caption, "parse_mode" => "Markdown"]]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $boturl ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($bodyobj) ); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $result=curl_exec ($ch);
This should work right out of the box. Will take a look at it once my pc is fixed.
Thanks!
Which version are you using?
3.5.0
Description of problem
EditMessageMedia method doesn't work.
I've tried with this code:
But it always fails with the error: "Bad Request: can't parse InputMedia: Media is not specified".
With the same parameters the classic POST call to telegram api with a JSON body works fine.