mirror of
https://github.com/QuasarApp/qTbot.git
synced 2025-04-25 21:34:33 +00:00
added first readme
This commit is contained in:
parent
fa99f10788
commit
c0a95d4842
79
README.md
79
README.md
@ -1,15 +1,70 @@
|
||||
# CMakeProject
|
||||
Template repository for cmake project
|
||||
Fork me and replase qTbot to Name of your new project.
|
||||
# qTbot
|
||||
This is Qt library for working with chat bots.
|
||||
|
||||
1. Clone this repository
|
||||
2. Run ./init.sh NewProjectName
|
||||
At this time This library supports next platforms:
|
||||
* Telegram (50%) - implemented only processing and sending messages and download files.
|
||||
|
||||
# This template supports next build targets:
|
||||
## Build and Include
|
||||
* cd yourRepo
|
||||
* git submodule add https://github.com/QuasarApp/easyssl.git # add the repository of Heart into your repo like submodule
|
||||
* git submodule update --init --recursive
|
||||
* Include in your CMakeLists.txt file the main CMakeLists.txt file of Heart library
|
||||
|
||||
| Command or make target | Description |
|
||||
|------|------|
|
||||
| **make test** | The run tests for a project (dependet of Qt Tests, so you need to add Qt in Cmake using CMAKE_PREFIX_PATH) |
|
||||
| **make doc** | The generate a documentation for a project (dependet of doxygen) |
|
||||
| **make deploy** | The generate distribution for a project (dependet of CQtDeployer) |
|
||||
| **make release** | The prepare Qt Installer framework repository for a project, generate a snap package and APK file for android (dependet of CQtDeployer, snapcraft, AndroidDeployer). |
|
||||
```cmake
|
||||
add_subdirectory(easyssl)
|
||||
```
|
||||
|
||||
* link the Heart library to your target
|
||||
```cmake
|
||||
target_link_libraries(yourLib PUBLIC easyssl)
|
||||
```
|
||||
* rebuild yuor project
|
||||
|
||||
|
||||
## Using
|
||||
|
||||
``` cpp
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
```
|
||||
|
@ -51,7 +51,7 @@ PROJECT_BRIEF = qTbot is base back end library for your c++ Qt projects
|
||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# the logo to the output directory.
|
||||
|
||||
PROJECT_LOGO = res/Logo_Web_alpha.png
|
||||
PROJECT_LOGO =
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
|
@ -4,11 +4,11 @@
|
||||
"src/build/Debug/qTbotEaxample.exe"
|
||||
],
|
||||
"clear": true,
|
||||
"binPrefix": "/home/andrei/gitHub/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug",
|
||||
"binPrefix": "/home/andrei/git/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug",
|
||||
"libDir": [
|
||||
"/media/D/builds/qTbot",
|
||||
"/home/andrei/git/qTbot",
|
||||
"/home/andrei/Qt/6.5.2/gcc_64",
|
||||
"/home/andrei/gitHub/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug"
|
||||
"/home/andrei/git/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug"
|
||||
],
|
||||
"recursiveDepth": "10",
|
||||
"deploySystem": false,
|
||||
@ -17,11 +17,11 @@
|
||||
"qif": true,
|
||||
"zip": true,
|
||||
"ignoreEnv": [
|
||||
"/media/D/builds/qTbot/Distro"
|
||||
"/home/andrei/git/qTbot/Distro"
|
||||
],
|
||||
"extraLib": "crypto",
|
||||
"targetDir": "/media/D/builds/qTbot/Distro",
|
||||
"deployVersion": "0.27.79b33b3",
|
||||
"targetDir": "/home/andrei/git/qTbot/Distro",
|
||||
"deployVersion": "0.28.fa99f10",
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#define QTBOT_VERSION "0.27.79b33b3"
|
||||
#define QTBOT_VERSION "0.28.fa99f10"
|
||||
|
||||
#if defined(QTBOT_LIBRARY)
|
||||
# define QTBOT_EXPORT Q_DECL_EXPORT
|
||||
|
@ -8,14 +8,14 @@
|
||||
#include "itelegrambot.h"
|
||||
#include "qTbot/messages/telegramupdateanswer.h"
|
||||
#include "file.h"
|
||||
#include "qTbot/requests/telegrammdownloadfile.h"
|
||||
#include "requests/telegrammdownloadfile.h"
|
||||
#include "qdir.h"
|
||||
#include "virtualfile.h"
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
#include <qTbot/requests/telegramgetfile.h>
|
||||
#include <qTbot/requests/telegramgetme.h>
|
||||
#include <qTbot/requests/telegramsendmsg.h>
|
||||
#include <requests/telegramgetfile.h>
|
||||
#include <requests/telegramgetme.h>
|
||||
#include <requests/telegramsendmsg.h>
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QSharedPointer>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define ITELEGRAMBOT_H
|
||||
|
||||
#include "ibot.h"
|
||||
#include "qTbot/messages/telegrammsg.h"
|
||||
#include <QObject>
|
||||
|
||||
class QNetworkAccessManager;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "telegramrestbot.h"
|
||||
#include "qTbot/messages/telegramupdate.h"
|
||||
#include "qTbot/messages/telegramupdateanswer.h"
|
||||
#include "qTbot/requests/telegramgetupdate.h"
|
||||
#include "requests/telegramgetupdate.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QTimer>
|
||||
|
Loading…
x
Reference in New Issue
Block a user