TelegramBotAPI icon indicating copy to clipboard operation
TelegramBotAPI copied to clipboard

QVector< InputMediaPhoto> cannot be used

Open kleuter opened this issue 1 year ago • 1 comments

You cannot actually use any of Telegram::Bot::sendMediaGroup methods, because you cannot create such vectors as QVector<InputMediaPhoto> for example.

One can only create such vectors using initializers:

QVector< InputMediaPhoto> v = { InputMediaPhoto(new QFile()), InputMediaPhoto(new QFile()) };

But you cannot add new items to it:

v.emplace_back(InputMediaPhoto(new QFile()) );

Possible solution: const Type type = Type::PHOTO; must be changed to Type type = Type::PHOTO; in the header.

kleuter avatar Apr 10 '24 16:04 kleuter

Same for InputMediaVideo

kleuter avatar Feb 04 '25 12:02 kleuter

Seems like yet another case of "const members are evil in C++". Basically, the type can not be copied around because it can not copy (write to) a const field.

ratijas avatar May 27 '25 00:05 ratijas