|
qTbot 0.2.123.6f57966
qTbot is base back end library for your c++ Qt projects.
|
The TelegramMsg class This class provides the general messages of telegram. The message object can contain text, geo data or a link to a video or image. All this data can be contained in one object. More...
#include <telegrammsg.h>


Public Types | |
| enum | QualitySelector { AroundSize = 0 , BestOf = 1 , Best = 2 , Fast = 3 } |
| The QualitySelector enum This is the behavior of image and video selection. More... | |
| using | Type = QString |
| Type This is a string value of the telegram message types. | |
Public Member Functions | |
| TelegramMsg () | |
| TelegramMsg default constructor. | |
| TelegramMsg (const QJsonObject &obj) | |
| Constructs a Message object from a JSON object. | |
| unsigned long long | messageId () const override |
| messageId returns the message ID. | |
| unsigned long long | fromId () const |
| fromId returns the sender's ID. | |
| bool | isBot () const |
| isBot checks if the sender is a bot. | |
| QString | firstName () const |
| firstName returns the sender's first name. | |
| QString | lastName () const |
| lastName returns the sender's last name. | |
| QString | username () const |
| username returns the sender's username. | |
| QString | languageCode () const |
| languageCode returns the sender's language code. | |
| QVariant | chatId () const override |
| chatId returns the chat ID. | |
| 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. | |
| QString | chatFirstName () const |
| chatFirstName returns the first participant's first name in the chat. | |
| QString | chatLastName () const |
| chatLastName returns the first participant's last name in the chat. | |
| QString | chatUsername () const |
| chatUsername returns the first participant's username in the chat. | |
| QString | chatType () const |
| chatType returns the chat type. | |
| qint64 | date () const |
| date returns the date of the sent message. | |
| QString | text () const |
| text returns text that contains this message object. | |
| QString | fullText () const |
| fullText Returns the text + caption value. | |
| QString | caption () const |
| caption Returns only the caption value. | |
| bool | contains (const Type &type) |
| contains This method returns true if the message contains the chosen data type. | |
| QList< QSharedPointer< TelegramImage > > | images () const |
| images This function returns an array of available image qualities | |
| QSharedPointer< TelegramImage > | image (QualitySelector behavior=AroundSize, int size=100000) const |
| Retrieve an image from the Telegram service with specified quality and size parameters. | |
| QSharedPointer< TelegramDocument > | documents () const |
| documents This method returns the contained document data. | |
| QSharedPointer< TelegramAudio > | audio () const |
| audio This method returns the contained audio data. | |
| QSharedPointer< TelegramContact > | contact () const |
| contact Returns the contact data. | |
| unsigned long long | updateId () const override |
| updateId This method returns the numeric id of the update. | |
| QSharedPointer< TelegramLocation > | location () const |
| location Returns the location object of the message. | |
| Public Member Functions inherited from qTbot::iMessage | |
| iMessage () | |
| iMessage default constructor. | |
| Public Member Functions inherited from qTbot::IJsonBasedUpdate | |
| IJsonBasedUpdate () | |
| IJsonBasedUpdate default constructor. | |
| void | setRawData (const QByteArray &newRawData) override |
| setRawData This method sets a new raw data value. | |
| Public Member Functions inherited from qTbot::iUpdate | |
| iUpdate () | |
| iUpdate default constructor. | |
| const QByteArray & | rawData () const |
| rawData returns the raw data of the update. The raw data is the not parsed value from the server. | |
| Public Member Functions inherited from qTbot::IJsonBasedObject | |
| IJsonBasedObject () | |
| IJsonBasedObject default constructor. | |
| IJsonBasedObject (const QJsonObject &newRawJson) | |
| IJsonBasedObject constructs the object from a raw json value. | |
| const QJsonObject & | rawJson () const |
| rawJson Telegram uses a rest api with json objects. So all received messages are parsed into a json object. | |
| virtual void | setRawJson (const QJsonObject &newRawJson) |
| setRawJson This method sets a new raw json data of the object. | |
Public Attributes | |
| const Type | Text = "text" |
| Text This is the text type of the message. | |
| const Type | Image = "photo" |
| Image This is the image type of the telegram. | |
| const Type | Document = "document" |
| Document This is the type of the documents. | |
| const Type | Contact = "contact" |
| Contact This is type of the files. | |
| const Type | Location = "location" |
| Location This is the type of location data. | |
| const Type | Audio = "audio" |
| Audio This is the type of audio files. | |
The TelegramMsg class This class provides the general messages of telegram. The message object can contain text, geo data or a link to a video or image. All this data can be contained in one object.
Definition at line 24 of file telegrammsg.h.
| using qTbot::TelegramMsg::Type = QString |
Type This is a string value of the telegram message types.
Definition at line 55 of file telegrammsg.h.
The QualitySelector enum This is the behavior of image and video selection.
Definition at line 31 of file telegrammsg.h.
| qTbot::TelegramMsg::TelegramMsg | ( | ) |
TelegramMsg default constructor.
Definition at line 14 of file telegrammsg.cpp.
| qTbot::TelegramMsg::TelegramMsg | ( | const QJsonObject & | obj | ) |
Constructs a Message object from a JSON object.
| obj | The JSON object containing message data. |
Definition at line 19 of file telegrammsg.cpp.

| QSharedPointer< TelegramAudio > qTbot::TelegramMsg::audio | ( | ) | const |
audio This method returns the contained audio data.
Definition at line 171 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::caption | ( | ) | const |
caption Returns only the caption value.
Definition at line 91 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::chatFirstName | ( | ) | const |
chatFirstName returns the first participant's first name in the chat.
Definition at line 63 of file telegrammsg.cpp.

|
overridevirtual |
chatId returns the chat ID.
Implements qTbot::iUpdate.
Definition at line 51 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::chatLastName | ( | ) | const |
chatLastName returns the first participant's last name in the chat.
Definition at line 67 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::chatType | ( | ) | const |
chatType returns the chat type.
Definition at line 75 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::chatUsername | ( | ) | const |
chatUsername returns the first participant's username in the chat.
Definition at line 71 of file telegrammsg.cpp.


| QSharedPointer< TelegramContact > qTbot::TelegramMsg::contact | ( | ) | const |
contact Returns the contact data.
Definition at line 175 of file telegrammsg.cpp.

| bool qTbot::TelegramMsg::contains | ( | const Type & | type | ) |
contains This method returns true if the message contains the chosen data type.
| type | This is the name of the type |
Definition at line 95 of file telegrammsg.cpp.

| qint64 qTbot::TelegramMsg::date | ( | ) | const |
date returns the date of the sent message.
Definition at line 79 of file telegrammsg.cpp.

| QSharedPointer< TelegramDocument > qTbot::TelegramMsg::documents | ( | ) | const |
documents This method returns the contained document data.
Definition at line 167 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::firstName | ( | ) | const |
firstName returns the sender's first name.
Definition at line 35 of file telegrammsg.cpp.

|
overridevirtual |
from This virtual function should return the id of the user that sent this update to the bot.
Implements qTbot::iUpdate.
Definition at line 59 of file telegrammsg.cpp.

| unsigned long long qTbot::TelegramMsg::fromId | ( | ) | const |
fromId returns the sender's ID.
Definition at line 27 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::fullText | ( | ) | const |
fullText Returns the text + caption value.
Definition at line 87 of file telegrammsg.cpp.

| QSharedPointer< TelegramImage > qTbot::TelegramMsg::image | ( | QualitySelector | behavior = AroundSize, |
| int | size = 100000 ) const |
Retrieve an image from the Telegram service with specified quality and size parameters.
This method allows you to request an image from the Telegram service with a specific quality selection behavior. You can control the image selection behavior by providing a QualitySelector enum value, and optionally, a maximum size limit.
| behavior | (Optional) The QualitySelector enum value that defines the image selection behavior. Defaults to AroundSize if not specified.
|
| size | (Optional) The required size for the image (in bytes). Defaults to 100,000 bytes if not specified. |
Definition at line 110 of file telegrammsg.cpp.

| QList< QSharedPointer< TelegramImage > > qTbot::TelegramMsg::images | ( | ) | const |
images This function returns an array of available image qualities
Definition at line 99 of file telegrammsg.cpp.

| bool qTbot::TelegramMsg::isBot | ( | ) | const |
isBot checks if the sender is a bot.
Definition at line 31 of file telegrammsg.cpp.

|
overridevirtual |
isValid returns true if the update is valid else false.
Reimplemented from qTbot::IJsonBasedUpdate.
Definition at line 55 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::languageCode | ( | ) | const |
languageCode returns the sender's language code.
Definition at line 47 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::lastName | ( | ) | const |
lastName returns the sender's last name.
Definition at line 39 of file telegrammsg.cpp.

| QSharedPointer< TelegramLocation > qTbot::TelegramMsg::location | ( | ) | const |
location Returns the location object of the message.
Definition at line 179 of file telegrammsg.cpp.

|
overridevirtual |
messageId returns the message ID.
Implements qTbot::iMessage.
Definition at line 23 of file telegrammsg.cpp.

| QString qTbot::TelegramMsg::text | ( | ) | const |
text returns text that contains this message object.
Definition at line 83 of file telegrammsg.cpp.

|
overridevirtual |
updateId This method returns the numeric id of the update.
Implements qTbot::iUpdate.
Definition at line 183 of file telegrammsg.cpp.
| QString qTbot::TelegramMsg::username | ( | ) | const |
username returns the sender's username.
Definition at line 43 of file telegrammsg.cpp.

| const Type qTbot::TelegramMsg::Audio = "audio" |
Audio This is the type of audio files.
Definition at line 85 of file telegrammsg.h.
| const Type qTbot::TelegramMsg::Contact = "contact" |
Contact This is type of the files.
Definition at line 75 of file telegrammsg.h.
| const Type qTbot::TelegramMsg::Document = "document" |
Document This is the type of the documents.
Definition at line 70 of file telegrammsg.h.
| const Type qTbot::TelegramMsg::Image = "photo" |
Image This is the image type of the telegram.
Definition at line 65 of file telegrammsg.h.
| const Type qTbot::TelegramMsg::Location = "location" |
Location This is the type of location data.
Definition at line 80 of file telegrammsg.h.
| const Type qTbot::TelegramMsg::Text = "text" |
Text This is the text type of the message.
Definition at line 60 of file telegrammsg.h.