This is Qt library for working with chat bots.
int main(
int argc,
char *argv[]) {
QCoreApplication app(argc, argv);
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.
login(
"6349356184:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
return app.exec();
}
void sigReceiveUpdate(const QSharedPointer< qTbot::iUpdate > &)
sigReceiveUpdate emitted when the bot receives any updates from users.
QSharedPointer< iUpdate > takeNextUnreadUpdate()
takeNextUnreadUpdate This method takes an unread update and marks it as read.
QFuture< QByteArray > getFile(const QString &fileId, FileType fileType=FileType::Ram) override
getFile This method sends a request to get a file by id. The files can be saved into local storage if...
bool sendSpecificMessage(const TelegramArgs &args, const qTbot::ExtraJsonObjects &extraObjects={})
Sends a specific message to a chat.
The TelegramRestBot class Is the rest implementation base on the getUpdates (long polling) telegram m...
bool login(const QByteArray &token) override
login This method gets basic information of the bot from the remote server and starts the long pollin...
The TelegramUpdate class contains base information about updates from telegram.
int main(int argc, char *argv[])