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
Using
int main(
int argc,
char *argv[]) {
QCoreApplication app(argc, argv);
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();
}
void sigReceiveUpdate(const QSharedPointer< iUpdate > &)
sigReceiveUpdate emit when but receive any updates from users.
QSharedPointer< iUpdate > takeNextUnreadUpdate()
takeNextUnreadUpdate This method take a unread update and mark them as read.
The TelegramRestBot class Is Rest implementation base on the Update API telegram method.
bool login(const QByteArray &token) override
login This method get bae information of the bot from remote server.
int main(int argc, char *argv[])