qTbot 0.87.9547b0c
qTbot is base back end library for your c++ Qt projects.
telegramcontact.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#include "telegramcontact.h"
8
9namespace qTbot {
10
15
16TelegramContact::TelegramContact(const QJsonObject &jsonObject): IJsonBasedObject(jsonObject) {
17
18}
19
20
21unsigned long long TelegramContact::userIdInt() const {
22 return rawJson()["user_id"].toInteger();
23}
24
25QVariant TelegramContact::userId() const {
26 return rawJson()["user_id"];
27}
28
30 return rawJson()["first_name"].toString();
31}
32
34 return rawJson()["last_name"].toString();
35}
36
38 return rawJson()["username"].toString();
39}
40
41QString TelegramContact::phone() const {
42 return rawJson()["phone_number"].toString();
43}
44
46 return rawJson()["language_code"].toString();
47}
48}
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 phone() const
chatUsername returns the first participant's username in the chat.
QString lastName() const
chatLastName returns the first participant's last name in the chat.
QString firstName() const
chatFirstName returns the first participant's first name in the chat.
QString username() const
chatUsername returns the first participant's username in the chat.
QString languageCode() const
languageCode returns the sender's language code.
QVariant userId() const
userId This is id of usercontact
unsigned long long userIdInt() const
userId This is id of usercontact