Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
815 stars 343 forks source link

sendVideoNote() #77

Closed weiddolo closed 7 years ago

weiddolo commented 7 years ago

How i can send videonote message from mp4 file?

$videonote= curl_file_create('sample-video.mp4','video/mp4'); $content = array('chat_id' => $telegram->ChatID(), 'video_note' => $videonote); $telegram->sendVideoNote($content);

but i have this response:

==========[Response]==========
ok:         False
error_code:     400
description:        Bad Request: wrong video note length
Eleirbag89 commented 7 years ago

This one is a bit tricky, because this limitation isn't clear in the Telegram Doc. I found this pull request: https://github.com/eternnoir/pyTelegramBotAPI/pull/338 it seems It's related to the length parameter which cuold be 639 maxiumum. I Downloaded a sample video http://techslides.com/demos/sample-videos/small.mp4 and this works:

if ($text == "/videonote") {
    $videonote= curl_file_create('small.mp4','video/mp4');
    $content = array('chat_id' => $chat_id, 'video_note' => $videonote, 'length'=> '639');
    $telegram->sendVideoNote($content);
}
weiddolo commented 7 years ago

Thanks! Solved!