tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
tgbotxx::Chat Struct Reference

This object represents a chat. https://core.telegram.org/bots/api#chat. More...

#include <Chat.hpp>

Inheritance diagram for tgbotxx::Chat:
tgbotxx::ChatFullInfo

Public Types

enum class  Type : std::uint8_t { Private = 0 , Group , Supergroup , Channel }
 Enum of possible types of Type. More...
 

Public Member Functions

 Chat ()=default
 
 Chat (const nl::json &json)
 
virtual ~Chat ()=default
 
virtual nl::json toJson () const
 Serializes this object to JSON.
 
virtual void fromJson (const nl::json &json)
 Deserializes this object from JSON.
 

Static Public Member Functions

static std::optional< std::string > TypeToString (const Type type) noexcept
 Converts enum Type to a string.
 
static std::optional< TypeStringToType (const std::string &str) noexcept
 Converts string to an enum Type.
 

Public Attributes

std::int64_t id {}
 Unique identifier for this chat.
 
Type type {}
 Type of chat, can be either “private”, “group”, “supergroup” or “channel”
 
std::string title
 Optional. Title, for supergroups, channels and group chats.
 
std::string username
 Optional. Username, for private chats, supergroups and channels if available.
 
std::string firstName
 Optional. First name of the other party in a private chat.
 
std::string lastName
 Optional. Last name of the other party in a private chat.
 
bool isForum {}
 Optional. True, if the supergroup chat is a forum (has topics enabled) https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups .
 
bool isDirectMessages {}
 Optional. True, if the supergroup chat is a forum (has topics enabled) https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups .
 

Detailed Description

This object represents a chat. https://core.telegram.org/bots/api#chat.

Definition at line 7 of file Chat.hpp.

Member Enumeration Documentation

◆ Type

enum class tgbotxx::Chat::Type : std::uint8_t
strong

Enum of possible types of Type.

Enumerator
Private 
Group 
Supergroup 
Channel 

Definition at line 19 of file Chat.hpp.

Constructor & Destructor Documentation

◆ Chat() [1/2]

tgbotxx::Chat::Chat ( )
default

◆ Chat() [2/2]

tgbotxx::Chat::Chat ( const nl::json &  json)
explicit

◆ ~Chat()

virtual tgbotxx::Chat::~Chat ( )
virtualdefault

Member Function Documentation

◆ fromJson()

virtual void tgbotxx::Chat::fromJson ( const nl::json &  json)
virtual

Deserializes this object from JSON.

Reimplemented in tgbotxx::ChatFullInfo.

◆ StringToType()

static std::optional< Type > tgbotxx::Chat::StringToType ( const std::string &  str)
staticnoexcept

Converts string to an enum Type.

◆ toJson()

virtual nl::json tgbotxx::Chat::toJson ( ) const
virtual

Serializes this object to JSON.

Returns
JSON representation of this object

Reimplemented in tgbotxx::ChatFullInfo.

◆ TypeToString()

static std::optional< std::string > tgbotxx::Chat::TypeToString ( const Type  type)
staticnoexcept

Converts enum Type to a string.

Member Data Documentation

◆ firstName

std::string tgbotxx::Chat::firstName

Optional. First name of the other party in a private chat.

Definition at line 40 of file Chat.hpp.

◆ id

std::int64_t tgbotxx::Chat::id {}

Unique identifier for this chat.

Note
This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.

Definition at line 16 of file Chat.hpp.

◆ isDirectMessages

bool tgbotxx::Chat::isDirectMessages {}

Optional. True, if the supergroup chat is a forum (has topics enabled) https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups .

Definition at line 51 of file Chat.hpp.

◆ isForum

bool tgbotxx::Chat::isForum {}

Optional. True, if the supergroup chat is a forum (has topics enabled) https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups .

Definition at line 47 of file Chat.hpp.

◆ lastName

std::string tgbotxx::Chat::lastName

Optional. Last name of the other party in a private chat.

Definition at line 43 of file Chat.hpp.

◆ title

std::string tgbotxx::Chat::title

Optional. Title, for supergroups, channels and group chats.

Definition at line 34 of file Chat.hpp.

◆ type

Type tgbotxx::Chat::type {}

Type of chat, can be either “private”, “group”, “supergroup” or “channel”

Definition at line 31 of file Chat.hpp.

◆ username

std::string tgbotxx::Chat::username

Optional. Username, for private chats, supergroups and channels if available.

Definition at line 37 of file Chat.hpp.


The documentation for this struct was generated from the following file: