17int main(
int argc,
char *argv[]) {
19 QCoreApplication::setOrganizationName(
"QuasarApp");
20 QCoreApplication::setOrganizationDomain(
"https://github.com/QuasarApp");
21 QCoreApplication::setApplicationName(
"qTbotExample");
23 QCoreApplication app(argc, argv);
29 QList<QSharedPointer<qTbot::iFile> > filesStack;
33 if (auto&& tupdate = update.dynamicCast<qTbot::TelegramUpdate>()) {
35 if (tupdate->contains(tupdate->MessageUpdate)) {
37 if (auto&& tmsg = tupdate->message()) {
38 if (tmsg->contains(tmsg->Document)) {
39 filesStack.push_back(bot.getFile(tmsg->documents()->fileId(), qTbot::iFile::Local));
42 if (tmsg->contains(tmsg->Image)) {
43 filesStack.push_back(bot.getFile(tmsg->image()->fileId(), qTbot::iFile::Local));
46 if (tmsg->contains(tmsg->Audio)) {
47 filesStack.push_back(bot.getFile(tmsg->audio()->fileId(), qTbot::iFile::Local));
50 bot.sendSpecificMessageWithKeyboard(qTbot::TelegramArgs{tmsg->chatId(),
"I see it", tmsg->messageId()},
51 {{{
"test_button", [tmsg, &bot](const QString& queryId, const QVariant& msgId){
54 auto&& args = qTbot::TelegramArgs{tmsg->chatId(),
55 "I see it. Presed count: " + QString::number(index++),
61 auto&& keyboard = qTbot::KeyboardOnMessage{
62 {{
"test_button", [](auto , auto ){}},
63 {
"test_button 2", [](auto , auto ){}}}};
65 bot.editSpecificMessageWithKeyboard(msgId,
71 bot.sendSpecificMessageWithKeyboard(qTbot::TelegramArgs{tmsg->chatId(),
"I see it", tmsg->messageId()},
73 {
"test_button"},}}, true, true);
81 bot.login(
"6349356184:AAFotw9EC46sgAQrkGQ_jeHPyv3EAapZXcM");
int main(int argc, char *argv[])