qTbot 0.89.ee6949a
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>
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)=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 QSharedPointer< iFile > | getFile (const QString &fileId, iFile::Type fileType=iFile::Type::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. | |
Protected Member Functions | |
virtual QString | makeUrl (const QSharedPointer< iRequest > &request) const =0 |
makeUrl This method prepare a prefix url for http requests. | |
QSharedPointer< QNetworkReply > | sendRequest (const QSharedPointer< iRequest > &rquest) |
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. | |
|
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 iFile::Type::Ram |
Implemented in qTbot::ITelegramBot.
|
protectedvirtual |
handleIncomeNewUpdate This method just emit the sigReceiveUpdate signal.
Reimplemented in qTbot::ITelegramBot.
Definition at line 138 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 24 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. |
markMessageAsUnprocessed This method add the message into a not processed messages store.
message | This is message that need to be unprocessed. |
|
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 |
sendRequest This method sent custom requests to the server.
rquest | This is message that will be sent to server. |
Definition at line 52 of file ibot.cpp.
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 154 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 32 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.
QSharedPointer< iUpdate > qTbot::IBot::takeNextUnreadUpdate | ( | ) |
const QByteArray & qTbot::IBot::token | ( | ) | const |