Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No response in sendAudio #886

Closed
sunildabhi opened this issue Sep 6, 2018 · 7 comments
Closed

No response in sendAudio #886

sunildabhi opened this issue Sep 6, 2018 · 7 comments

Comments

@sunildabhi
Copy link

sunildabhi commented Sep 6, 2018

Required Information

  • Operating system:Linux
  • PHP version:5.6.30
  • PHP Telegram Bot version:0.54.0
  • Using MySQL database: yes
  • MySQL version:5.5.60-cll
  • Update Method: Webhook
  • Self-signed certificate: no
  • RAW update (if available):

Expected behaviour

There should be mp3 file with play button for play it.

Actual behaviour

but not getting any response

Steps to reproduce

bellow is code for sending it:

$url = str_replace(" ", "%20", $audio['file']);
$data['caption'] = $audio['title'];
$data['title'] = $audio['artist'];
$data['audio'] = Request::encodeFile($url);

Request::sendAudio($data);

Extra details

bellow is log when i am sending audio file:

[2018-09-06 12:17:39] bot_log.ERROR: exception 'Longman\TelegramBot\Exception\TelegramException' with message 'Telegram returned an invalid response!' in /vendor/longman/telegram-bot/src/Request.php:472
Stack trace:
#0 [internal function]: Longman\TelegramBot\Request::send('sendAudio', Array)
#1 /vendor/longman/telegram-bot/src/Request.php(574): call_user_func_array('static::send', Array)
#2 /Commands/CallbackqueryCommand.php(102): Longman\TelegramBot\Request::__callStatic('sendAudio', Array)
#3 /Commands/CallbackqueryCommand.php(102): Longman\TelegramBot\Request::sendAudio(Array)
#4 /vendor/longman/telegram-bot/src/Commands/Command.php(173): Longman\TelegramBot\Commands\SystemCommands\CallbackqueryCommand->execute()
#5 /vendor/longman/telegram-bot/src/Telegram.php(537): Longman\TelegramBot\Commands\Command->preExecute()
#6 /vendor/longman/telegram-bot/src/Telegram.php(505): Longman\TelegramBot\Telegram->executeCommand('Callbackquery')
#7 /vendor/longman/telegram-bot/src/Telegram.php(423): Longman\TelegramBot\Telegram->processUpdate(Object(Longman\TelegramBot\Entities\Update))
#8 /hook.php(52): Longman\TelegramBot\Telegram->handle()
#9 {main} [] []
@noplanman
Copy link
Member

When sending an audio file from a URL, there is no need to use Request::encodeFile(...), just pass the URL directly to the audio property.

@sunildabhi
Copy link
Author

sunildabhi commented Sep 24, 2018

i tried but still no action, i attached log files check it
SHATest_Bot_update.log
SHATest_Bot_debug.log

Edit by @noplanman: Removed log files.

@noplanman
Copy link
Member

noplanman commented Sep 24, 2018

Hi @sunildabhi
I have removed your log files, as they contained your bot API token.

Please reset them immediately via @BotFather ❗ (Select your bot, then API Token, then Revoke current token)

Regarding your issue, your debug log showed a 400 Bad Request error, which means your request has invalid data in it.
Have another look at the official sendAudio documentation to make sure you have filled all necessary fields and that they are valid.

@sunildabhi
Copy link
Author

i have audio file with size of 65mb can you tell me how to send it? because using url there is limit max size 20mb.

@chuv1
Copy link

chuv1 commented Oct 11, 2018

Sent it to your bot via your messenger and get file_id of the file. Send file by it's file_id.

@noplanman
Copy link
Member

@sunildabhi Can we close off here?

@sunildabhi
Copy link
Author

sunildabhi commented Oct 22, 2018

yes thanks for help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants