reo7sp / tgbot-cpp

C++ library for Telegram bot API

Home Page:http://reo7sp.github.io/tgbot-cpp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bot can't send any video with any method^

Amirhan-Taipovjan-Greatest-I opened this issue · comments

I updated tgbot-cpp library and this code fragment:

    bot.getEvents().onCommand("test", [&bot](Message::Ptr message) {
        if (StringTools::startsWith(message->text, "/start")) {
            return;
        }
        bot.getApi().sendAnimation(message->chat->id, "http://i.imgur.com/IF9716I.mp4", 100, 100, 100, nullptr, "*text*", 0, 0, "Markdown");
        });

doesn't working, but it was working in older version (probably August).

Error message:

Вызвано исключение по адресу 0x00007FFDCD93146C (vcruntime140d.dll) в testbot.exe: 0xC0000005: нарушение прав доступа при чтении по адресу 0xFFFFFFFFFFFFFFFF.

How can I solve this problem?

^ -- any mp4 with methods like sendVideo, sendVideoNote, SendAnimation.

Thanks! Currently there is still an error with passing nullptr. I tried the sendAnimation function with the library version from July and passing nullptr also throws an error there. Do you still know the exact version where this worked?
Currently, the thumb parameter takes either a pointer or a string. Nullptr can be converted into both types in this case and there is an error as a result. If you pass "" as thumb, then it should work.

bot.getEvents().onCommand("test", [&bot](Message::Ptr message) {
if (StringTools::startsWith(message->text, "/start")) {
return;
}
bot.getApi().sendAnimation(message->chat->id, "http://i.imgur.com/IF9716I.mp4", 100, 100, 100, nullptr, "text", 0, 0, "Markdown");
});

I also tried this:

    bot.getEvents().onCommand("test", [&bot](Message::Ptr message) {
        if (StringTools::startsWith(message->text, "/start")) {
            return;
        }
        bot.getApi().sendAnimation(message->chat->id, "http://i.imgur.com/IF9716I.mp4");
        });

And still same error,

Thanks! Currently there is still an error with passing nullptr. I tried the sendAnimation function with the library version from July and passing nullptr also throws an error there. Do you still know the exact version where this worked? Currently, the thumb parameter takes either a pointer or a string. Nullptr can be converted into both types in this case and there is an error as a result. If you pass "" as thumb, then it should work.

Also I need to say "thank you" because your commit solved My problem!

Thanks! Currently there is still an error with passing nullptr. I tried the sendAnimation function with the library version from July and passing nullptr also throws an error there. Do you still know the exact version where this worked? Currently, the thumb parameter takes either a pointer or a string. Nullptr can be converted into both types in this case and there is an error as a result. If you pass "" as thumb, then it should work.

Can I close My issue as resolved? Or it can't be counted as resolved because of:

...there is still an error with passing nullptr...

No, you can close the issue. If someone absolutely has to pass a nullptr and it doesn't work because of that, one can always look at it then