smartnode/telebot

Failed to send file as document, server response is 400

Closed this issue · 6 comments

ret = telebot_send_document(handle, sstgbconf.user_id, sstgbconf.docfile, true, false, 0, NULL); if (ret != TELEBOT_ERROR_NONE) { printf("Failed to send document: %d \n", ret); }

The result is:

[ERROR][telebot_core_curl_perform:95]Wrong HTTP response received, response: 400
Failed to send document: -1

Possibly changes in Telegram API ?

Full source code of the bot available: https://github.com/denzen84/sstgb

Does it fail only with sending document? Or everything else (message, video)?

It fails only with sending documents. I tried different types (text, pdf, jpg, mp4 ...). Sending text messages, images and videos works fine.

So, I found and fix this bug:

telebot-core.c: line 456:
return telebot_core_curl_perform(core_h, TELEBOT_METHOD_SEND_DOCUMENT, post);

there was method TELEBOT_METHOD_SEND_PHOTO instead of TELEBOT_METHOD_SEND_DOCUMENT.

Please update master branch :)

Thanks for the bug fix. You may also pull request.