Closed Nachtalb closed 11 months ago
Telegram returns helpful error messages. Show these to the developer so that he knows what the problem is.
Here is an example:
void echo_photo_as_document(telebot_handler_t handle, telebot_update_t update) { telebot_error_e ret; telebot_message_t message = update.message; telebot_photo_t photo = message.photos[message.count_photos - 1]; char *caption; asprintf(&caption, "width: %d, height: %d, file_size: %d", photo.width, photo.height, photo.file_size); ret = telebot_send_document(handle, message.chat->id, photo.file_id, false, NULL, caption, "HTML", false, 0, ""); free(caption); if (ret != TELEBOT_ERROR_NONE) { printf("Failed to send message: %d \n", ret); } }
This would now return:
[ERROR][telebot_core_curl_perform:145]HTTP error: 400 - "Bad Request: can't use file of type Photo as Document"
Telegram returns helpful error messages. Show these to the developer so that he knows what the problem is.
Here is an example:
This would now return: