qTbot 0.89.ee6949a
qTbot is base back end library for your c++ Qt projects.
|
The TelegramMsg class This class provide general mesasges of telegram. The message object can contains text, geo or link to video,image. all this dates can be contains in one object. More...
#include <telegrammsg.h>
Public Types | |
enum | QualitySelector { AroundSize = 0 , BestOf = 1 , Best = 2 , Fast = 3 } |
The QualitySelector enum This is behavior of image and video selection. More... | |
using | Type = QString |
Type just string value of the telegram messages types. | |
Public Member Functions | |
TelegramMsg () | |
TelegramMsg (const QJsonObject &obj) | |
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 return true if the message is valid else false. | |
QString | from () const override |
from This virtual function should return name of the user that sent this message to 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 date of the snet message. | |
QString | text () const |
text returns text that contains this message object. | |
QString | fullText () const |
fullText return text + caption value | |
QString | caption () const |
caption return only caption value | |
bool | contains (const Type &type) |
contains This method returns true if the message contains choosed data type. | |
QList< QSharedPointer< TelegramImage > > | images () const |
images This function returns array of available images qualites | |
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 contained document data. | |
QSharedPointer< TelegramAudio > | audio () const |
audio This method returns contained audio data. | |
QSharedPointer< TelegramContact > | contact () const |
contact return contact | |
unsigned long long | updateId () const override |
updateId This method returns numeric id of the update. | |
QSharedPointer< TelegramLocation > | location () const |
location returns location object of message. | |
Public Member Functions inherited from qTbot::iMessage | |
iMessage () | |
Public Member Functions inherited from qTbot::IJsonBasedUpdate | |
IJsonBasedUpdate () | |
void | setRawData (const QByteArray &newRawData) override |
setRawData This method sets new raw data value. | |
Public Member Functions inherited from qTbot::iUpdate | |
iUpdate () | |
const QByteArray & | rawData () const |
rawData returns raw data of the message. The raw data is not parsed value form the server. | |
Public Member Functions inherited from qTbot::IJsonBasedObject | |
IJsonBasedObject () | |
IJsonBasedObject (const QJsonObject &newRawJson) | |
const QJsonObject & | rawJson () const |
rawJson Telegram use rest api with json objects. So all received messages will be parsed in to jsobject. | |
virtual void | setRawJson (const QJsonObject &newRawJson) |
setRawJson this method convert jsobject into telegram message. | |
Public Attributes | |
const Type | Text = "text" |
Text This is text type of the message. | |
const Type | Image = "photo" |
Image This is image type of the telegram. | |
const Type | Document = "document" |
Document This is type of the files. | |
const Type | Contact = "contact" |
Contact This is type of the files. | |
const Type | Location = "location" |
Location This is type of location data. | |
const Type | Audio = "audio" |
Audio This is type of Audio files. | |
The TelegramMsg class This class provide general mesasges of telegram. The message object can contains text, geo or link to video,image. all this dates can be contains in one object.
Definition at line 24 of file telegrammsg.h.
using qTbot::TelegramMsg::Type = QString |
Type just string value of the telegram messages types.
Definition at line 48 of file telegrammsg.h.
The QualitySelector enum This is behavior of image and video selection.
Definition at line 31 of file telegrammsg.h.
qTbot::TelegramMsg::TelegramMsg | ( | ) |
Definition at line 14 of file telegrammsg.cpp.
qTbot::TelegramMsg::TelegramMsg | ( | const QJsonObject & | obj | ) |
QSharedPointer< TelegramAudio > qTbot::TelegramMsg::audio | ( | ) | const |
audio This method returns contained audio data.
Definition at line 171 of file telegrammsg.cpp.
QString qTbot::TelegramMsg::caption | ( | ) | const |
caption return only 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 return contact
Definition at line 175 of file telegrammsg.cpp.
bool qTbot::TelegramMsg::contains | ( | const Type & | type | ) |
contains This method returns true if the message contains choosed data type.
type | This is name of the type |
Definition at line 95 of file telegrammsg.cpp.
qint64 qTbot::TelegramMsg::date | ( | ) | const |
date returns date of the snet message.
Definition at line 79 of file telegrammsg.cpp.
QSharedPointer< TelegramDocument > qTbot::TelegramMsg::documents | ( | ) | const |
documents This method returns 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 name of the user that sent this message to 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 return 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 array of available images qualites
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 return true if the message 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 location object of 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 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 type of Audio files.
Definition at line 78 of file telegrammsg.h.
const Type qTbot::TelegramMsg::Contact = "contact" |
Contact This is type of the files.
Definition at line 68 of file telegrammsg.h.
const Type qTbot::TelegramMsg::Document = "document" |
Document This is type of the files.
Definition at line 63 of file telegrammsg.h.
const Type qTbot::TelegramMsg::Image = "photo" |
Image This is image type of the telegram.
Definition at line 58 of file telegrammsg.h.
const Type qTbot::TelegramMsg::Location = "location" |
Location This is type of location data.
Definition at line 73 of file telegrammsg.h.
const Type qTbot::TelegramMsg::Text = "text" |
Text This is text type of the message.
Definition at line 53 of file telegrammsg.h.