Andrei Yankovich 2e440aba9a
All checks were successful
buildbot/DocsGenerator Build finished.
buildbot/LinuxCMakeBuilderQt6 Build finished.
Merge pull request #22 from QuasarApp/fix_freaze
Fix freaze
2025-02-19 13:59:12 +01:00
2025-02-19 13:28:56 +01:00
2025-02-19 13:30:14 +01:00
2023-12-31 09:43:31 +01:00
2023-10-01 12:50:23 +02:00
2023-08-30 18:29:45 +02:00
2025-02-07 09:56:22 +01:00
2023-09-28 17:42:12 +02:00
2023-08-30 16:28:44 +00:00
2023-11-25 12:18:56 +03:00

qTbot

This is Qt library for working with chat bots.

At this time This library supports next platforms:

  • Telegram Rest (80%) - implemented only processing and sending messages and download files.

Build and Include

  • cd yourRepo

  • git submodule add https://github.com/QuasarApp/qTbot.git # add the repository of qTbot into your repo like submodule

  • git submodule update --init --recursive

  • Include in your CMakeLists.txt file the main CMakeLists.txt file of qTbot library

    add_subdirectory(qTbot)
    
  • link the qTbot library to your target

    target_link_libraries(yourApp PUBLIC qTbot)
    
  • rebuild yuor project

Using


#include <qTbot/telegramrestbot.h>
#include <qTbot/messages/telegrammsg.h>
#include <qTbot/messages/telegramupdate.h>

int main(int argc, char *argv[]) {

    QCoreApplication app(argc, argv);

    qTbot::TelegramRestBot bot;

    QObject::connect(&bot, &qTbot::TelegramRestBot::sigReceiveUpdate, [&bot, &filesStack](auto){
        while(auto&& update = bot.takeNextUnreadUpdate()) {

            if (auto&& tupdate = update.dynamicCast<qTbot::TelegramUpdate>()) {

                if (tupdate->contains(tupdate->MessageUpdate)) {

                    if (auto&& tmsg = tupdate->message()) {
                        if (tmsg->contains(tmsg->Document)) {
                            bot.getFile(tmsg->documents()->fileId(), qTbot::iFile::Local);
                        }

                        if (tmsg->contains(tmsg->Image)) {
                            bot.getFile(tmsg->image()->fileId(), qTbot::iFile::Local);
                        }

                        if (tmsg->contains(tmsg->Audio)) {
                            bot.getFile(tmsg->audio()->fileId(), qTbot::iFile::Local);
                        }
                        bot.sendSpecificMessage({tmsg->chatId(), "I see it"}, tmsg->messageId());
                    }

                }
            }
        }
    });

    bot.login("6349356184:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    
    return app.exec();
}

Description
No description provided
Readme SSPL-1.0 697 KiB
Languages
C++ 94.7%
CMake 4.3%
Java 1%