qTbot 0.2.107.d8fc923
qTbot is base back end library for your c++ Qt projects.
|
The IBot class Base interface for all chat-bots objcts. More...
#include <ibot.h>
Classes | |
struct | RequestData |
The RequestData class is simple wrapper of request object with path of responce. If Path of responce is empty then responce will saved in RAM. More... | |
Public Types | |
enum | FileType { Ram , Local } |
The FileType enum is is file types, deffine how we should download a file - as a local object in file system or into virtual memory. More... | |
Signals | |
void | sigReceiveUpdate (const QSharedPointer< iUpdate > &) |
sigReceiveUpdate emit when but receive any updates from users. | |
void | sigStopRequire () |
sigStopRequire just custm event for stop bot if tou use services. | |
Public Member Functions | |
IBot () | |
~IBot () | |
virtual bool | login (const QByteArray &token)=0 |
login This method get bae information of the bot from remote server. | |
virtual void | logout () |
login This method remove login token of bot. | |
virtual bool | sendMessage (const QVariant &chatId, const QString &text, iRequest::RequestPriority priority=iRequest::NormalPriority)=0 |
sendMessage This method sents text to the selected chat. | |
virtual bool | deleteMessage (const QVariant &chatId, const QVariant &messageId)=0 |
deleteMessage This is main method to delete messages. | |
virtual QFuture< QByteArray > | getFile (const QString &fileId, FileType fileType=Ram)=0 |
Get a file by its ID. | |
virtual bool | sendFile (const QFileInfo &file, const QVariant &chatId)=0 |
send file . | |
virtual bool | sendFile (const QByteArray &file, const QString &fileName, const QVariant &chatId)=0 |
sendFile This method setns a file that saved as a bytearray. | |
const QByteArray & | token () const |
token This is token value for authication on the remote server (bot) | |
const QString & | name () const |
name This is name of the bot. usualy it fields will be received from the server after autication. | |
void | setName (const QString &newName) |
setName This method sets new value for the IBot::name field. | |
QSharedPointer< iUpdate > | takeNextUnreadUpdate () |
takeNextUnreadUpdate This method take a unread update and mark them as read. | |
QSet< unsigned long long > | processed () const |
processed This method return list of processed mesages. | |
virtual void | setProcessed (const QSet< unsigned long long > &newProcessed) |
setProcessed This method sets new list of processed mesages. | |
int | reqestLimitPerSecond () const |
reqestLimitPerSecond this is request performence limitation. by default is 20 requests per second | |
void | setReqestLimitPerSecond (int newReqestLimitPerSecond) |
setReqestLimitPerSecond this method sets new limitation of bot performance. | |
int | parallelActiveNetworkThreads () const |
parallelActiveNetworkThreads | |
void | setParallelActiveNetworkThreads (int newParallelActiveNetworkThreads) |
setParallelActiveNetworkThreads | |
unsigned long long | totalSentRequests () const |
totalSentRequests This is total prepared requests count of bot from the start. | |
QDateTime | startTime () const |
startTime this is time when bol wil started. | |
Protected Member Functions | |
virtual QString | makeUrl (const QSharedPointer< iRequest > &request) const =0 |
makeUrl This method prepare a prefix url for http requests. | |
QFuture< QByteArray > | sendRequest (const QSharedPointer< iRequest > &rquest) |
sendRequest This method sent custom requests to the server. | |
QFuture< QByteArray > | sendRequest (const QSharedPointer< iRequest > &rquest, const QString &pathToResult) |
sendRequest This method sent custom requests to the server. | |
void | setToken (const QByteArray &newToken) |
setToken This is setter of the IBot::token value. | |
void | incomeNewUpdate (const QSharedPointer< iUpdate > &message) |
incomeNewUpdate This method save incomed messages into store. | |
void | markUpdateAsProcessed (const QSharedPointer< iUpdate > &message) |
markMessageAsProcessed This method remove message from the not processed messages store. | |
void | markUpdateAsUnprocessed (const QSharedPointer< iUpdate > &message) |
markMessageAsUnprocessed This method add the message into a not processed messages store. | |
void | markUpdateAsUnprocessed (unsigned long long messageID) |
markMessageAsUnprocessed This method add the message into a not processed messages store. | |
virtual QString | defaultFileStorageLocation () const |
defaultFileStorageLocation This method return default file storage location. | |
virtual void | handleIncomeNewUpdate (const QSharedPointer< iUpdate > &) |
handleIncomeNewUpdate This method just emit the sigReceiveUpdate signal. | |
Static Protected Member Functions | |
template<class MessageType , class ... Args> | |
static QSharedPointer< MessageType > | makeMesasge (const QByteArray &data, Args &&...args) |
makeMesasge This is factory method tha can create a messages types. | |
template<class MessageType , class ... Args> | |
static QSharedPointer< MessageType > | makeMesasge (const QJsonObject &data, Args &&...args) |
makeMesasge This is factory method tha can create a messages types. | |
The FileType enum is is file types, deffine how we should download a file - as a local object in file system or into virtual memory.
|
protectedvirtual |
|
pure virtual |
deleteMessage This is main method to delete messages.
chatId | This is cahat id wher will be removed message. |
messageId | This is removed message id. |
Implemented in qTbot::ITelegramBot.
|
pure virtual |
Get a file by its ID.
This function allows you to retrieve a file by its ID.
fileId | The ID of the file to retrieve. |
fileType | This is a saving way, by Default will be used a FileType::Ram |
Implemented in qTbot::ITelegramBot.
|
protectedvirtual |
handleIncomeNewUpdate This method just emit the sigReceiveUpdate signal.
Reimplemented in qTbot::ITelegramBot.
Definition at line 182 of file ibot.cpp.
|
protected |
|
pure virtual |
login This method get bae information of the bot from remote server.
token | This is token value for login |
Implemented in qTbot::ITelegramBot, and qTbot::TelegramRestBot.
|
virtual |
login This method remove login token of bot.
Reimplemented in qTbot::TelegramRestBot.
Definition at line 30 of file ibot.cpp.
|
inlinestaticprotected |
|
inlinestaticprotected |
|
protectedpure virtual |
makeUrl This method prepare a prefix url for http requests.
request | - This is request object for that will be prepared url. |
Implemented in qTbot::ITelegramBot.
|
protected |
|
protected |
markMessageAsUnprocessed This method add the message into a not processed messages store.
message | This is message that need to be unprocessed. |
Definition at line 170 of file ibot.cpp.
markMessageAsUnprocessed This method add the message into a not processed messages store.
message | This is message that need to be unprocessed. |
int qTbot::IBot::parallelActiveNetworkThreads | ( | ) | const |
int qTbot::IBot::reqestLimitPerSecond | ( | ) | const |
|
pure virtual |
sendFile This method setns a file that saved as a bytearray.
file | This is file source. |
fileName | This is name of file. |
chatId | This is chat of the receivers. |
Implemented in qTbot::ITelegramBot.
send file .
file | This is a file that you want to send. |
chatId | id of the chat. |
Implemented in qTbot::ITelegramBot.
|
pure virtual |
sendMessage This method sents text to the selected chat.
chatId | This is selected chat id |
text | This is text that neet to sent. |
Implemented in qTbot::ITelegramBot.
|
protected |
|
protected |
sendRequest This method sent custom requests to the server.
rquest | This is message that will be sent to server. |
setName This method sets new value for the IBot::name field.
newName | This is new value of the IBot::name property |
setProcessed This method sets new list of processed mesages.
newProcessed | list of processed messagees. |
Reimplemented in qTbot::TelegramRestBot.
Definition at line 308 of file ibot.cpp.
|
protected |
setToken This is setter of the IBot::token value.
newToken | This is new value of the token. |
Definition at line 38 of file ibot.cpp.
|
signal |
sigReceiveUpdate emit when but receive any updates from users.
|
signal |
sigStopRequire just custm event for stop bot if tou use services.
QDateTime qTbot::IBot::startTime | ( | ) | const |
QSharedPointer< iUpdate > qTbot::IBot::takeNextUnreadUpdate | ( | ) |
const QByteArray & qTbot::IBot::token | ( | ) | const |