qTbot 0.2.123.6f57966
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-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#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}
const QJsonObject & rawJson() const
rawJson Telegram uses a rest api with json objects. So all received messages are parsed into a json o...
IJsonBasedObject()
IJsonBasedObject default constructor.
QString fileId() const
Returns the file ID of the file.
QString fileUniqueId() const
Returns the unique ID of the file.
int fileSize() const
Returns the file size of the file.
TelegramFile()
TelegramFile default constructor.
QString takePath()
Returns the file path to get from the web.