qTbot 0.2.123.6f57966
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-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#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}
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 phone() const
phone Returns the phone number of the contact.
QString lastName() const
lastName Returns the last name of the contact.
QString firstName() const
firstName Returns the first name of the contact.
TelegramContact()
TelegramContact default constructor.
QString username() const
username Returns the username of the contact.
QString languageCode() const
languageCode Returns the language code of the contact.
QVariant userId() const
userId This is the id of the user contact.
unsigned long long userIdInt() const
userIdInt This is the numeric id of the user contact.