qTbot 0.2.123.6f57966
qTbot is base back end library for your c++ Qt projects.
telegramrestbot.h
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2026 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8
9#ifndef TELEGRAMRESTBOT_H
10#define TELEGRAMRESTBOT_H
11
12#include "itelegrambot.h"
13
14class QTimer;
15
16namespace qTbot {
17
22class QTBOT_EXPORT TelegramRestBot: public ITelegramBot
23{
24 Q_OBJECT
25public:
30
35
36 // IBot interface
43 bool login(const QByteArray &token) override;
44
48 void logout() override;
49
54 int updateDelay() const;
55
60 void setUpdateDelay(int newUpdateDelay);
61
67 void setProcessed(const QSet<unsigned long long> &newProcessed) override;
68private slots:
69 void handleReceiveUpdates(const QByteArray &replay);
70 void handleReceiveUpdatesErr(QNetworkReply::NetworkError err);
71
72private:
73 void startUpdates();
74
75 bool _run = false;
76 long long _lanstUpdateTime = 0;
77 unsigned long long _lanstUpdateid = 0;
78
79 int _updateDelay = 1000;
80
81};
82}
83#endif // TELEGRAMRESTBOT_H
const QByteArray & token() const
token This is the token value for authentication on the remote server (bot).
Definition ibot.cpp:36
ITelegramBot()
ITelegramBot default constructor.
void logout() override
logout This method stops the long polling of the updates and removes the login token of the bot.
void setUpdateDelay(int newUpdateDelay)
setUpdateDelay This method sets a new value for the TelegramRestBot::updateDelay property.
void setProcessed(const QSet< unsigned long long > &newProcessed) override
setProcessed This method sets a new list of processed updates. The bot will start to receive the upda...
bool login(const QByteArray &token) override
login This method gets basic information of the bot from the remote server and starts the long pollin...
int updateDelay() const
updateDelay This is the interval "how many msecs the bot will wait to send the next request for updat...
TelegramRestBot()
TelegramRestBot default constructor.