Closed OMRKiruha closed 10 months ago
Hi @OMRKiruha , you're right, currently sendMediaGroup is implemented to send only URL & already uploaded files ids.
I have made some changes to the Api. Now you can send local files by wrapping your file path with a cpr::File
of any media type.
for example sending a photo media group will be like:
std::vector<Ptr<InputMedia>> mediaGroup;
for (const std::string localPhoto : {"/path/to/photo1.jpg", "/path/to/photo2.jpg", "/path/to/photo3.jpg"}) {
Ptr<InputMediaPhoto> photo(new InputMediaPhoto());
photo->media = cpr::File{localPhoto}; // Local
photo->hasSpoiler = false;
mediaGroup.push_back(photo);
}
api()->sendMediaGroup(message->chat->id, mediaGroup);
Note: You can also mix local and URL/id photos in one media group, as well as other media types (document, video, audio and animation).
Please don't hesitate to open an issue of any question or problem you may encounter. Thank you for reporting this missing feature and have a great day!
Thank you very much. I am glad that the library is developing. Thanks for the great support.
Hi! Can I send 4-5 local photo in one message by sendMediaGroup? I can't found how make InputMediaPhoto from local file.