qTbot 0.89.ee6949a
qTbot is base back end library for your c++ Qt projects.
telegramfile.cpp
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2024 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#include "telegramfile.h"
10
11namespace qTbot {
12
16
17TelegramFile::TelegramFile(const QJsonObject &jsonObject): IJsonBasedObject(jsonObject) {
18
19}
20
22 return rawJson()["file_size"].toInt();
23}
24
26 if (_used)
27 return "";
28
29 _used = true;
30
31 return rawJson()["file_path"].toString();
32}
33
34QString TelegramFile::fileId() const {
35 return rawJson()["file_id"].toString();
36}
37
38
40 return rawJson()["file_unique_id"].toString();
41}
42
43}
The IJsonBasedObject class This is base interface for all json base objects.
const QJsonObject & rawJson() const
rawJson Telegram use rest api with json objects. So all received messages will be parsed in to jsobje...
QString fileId() const
Returns the file ID of the photo.
QString fileUniqueId() const
Returns the unique ID of the photo.
int fileSize() const
Returns the file size of the photo.
QString takePath()
Returns the file path to get from web.