qTbot 0.2.123.6f57966
qTbot is base back end library for your c++ Qt projects.
telegramupdateanswer.cpp
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
9
10namespace qTbot {
11
16
17QJsonValue TelegramUpdateAnswer::result() const {
18 return rawJson().value("result");
19}
20
22 return rawJson().value("error_code").toInt();
23}
24
26 return rawJson().value("description").toString();
27}
28
30 return "";
31}
32
34 return {};
35}
36
37unsigned long long TelegramUpdateAnswer::updateId() const {
38 return 0;
39}
40
42 return rawJson().value("ok").toBool();
43}
44
45}
const QJsonObject & rawJson() const
rawJson Telegram uses a rest api with json objects. So all received messages are parsed into a json o...
QVariant chatId() const override
chatId This virtual function should return the id of the chat that sent this update to the bot.
TelegramUpdateAnswer()
TelegramUpdateAnswer default constructor.
unsigned long long updateId() const override
updateId This method returns the numeric id of the update.
QString errorDescription() const
errorDescription This is the text description of what happened.
int errorCode() const
errorCode This is the error code (if it exists).
QJsonValue result() const
result This is the result field of the telegram response.
bool isValid() const override
isValid returns true if the update is valid else false.
QString from() const override
from This virtual function should return the id of the user that sent this update to the bot.