reo7sp/tgbot-cpp
Hey guys, everytime I try to use the sendPhoto function this text is displayed in the output window: error: **ios_base::failbit set: iostream stream error
**
sendPhoto function: https://core.telegram.org/bots/api#sendphoto
InputFile: https://core.telegram.org/bots/api#inputfile
This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
^Maybe this could have something to do with my problem? I’m not entirely sure if I’m following through with this requirement.
I was following the sample. on the tgbot github.
Here is my code:
string photoFilePath = "exmaple.jpg";
string photoMimeType = "image/jpeg";
bot.getEvents().onCommand("start", [&bot, &kb_startMenu, &photoFilePath, &photoMimeType](Message::Ptr message) {
bot.getApi().sendPhoto(message->chat->id, InputFile::fromFile(photoFilePath, photoMimeType));
});