tgbotxx  1.1.6.9
Telegram Bot C++ Library
tgbotxx::Chat Struct Reference

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

#include <Chat.hpp>

Public Types

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

Public Member Functions

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

Static Public Member Functions

static constexpr Type Str2Type (const std::string &str)
 

Public Attributes

std::int64_t id {}
 Unique identifier for this chat. More...
 
Type type {}
 Type of chat, can be either “private”, “group”, “supergroup” or “channel” More...
 
std::string title
 Optional. Title, for supergroups, channels and group chats. More...
 
std::string username
 Optional. Username, for private chats, supergroups and channels if available. More...
 
std::string firstName
 Optional. First name of the other party in a private chat. More...
 
std::string lastName
 Optional. Last name of the other party in a private chat. More...
 
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 . More...
 
Ptr< ChatPhotophoto
 Optional. Chat photo. Returned only in getChat. More...
 
std::vector< std::string > activeUsernames
 Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. More...
 
std::vector< Ptr< ReactionType > > availableReactions
 Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat. More...
 
std::int32_t accentColorId {}
 Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. Always returned in getChat. More...
 
std::string backgroundCustomEmojiId
 Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat. More...
 
std::int32_t profileAccentColorId {}
 Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat. More...
 
std::string profileBackgroundCustomEmojiId
 Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat. More...
 
std::string emojiStatusCustomEmojiId
 Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. https://core.telegram.org/bots/api#getchat . More...
 
std::time_t emojiStatusExpirationDate {}
 Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. https://core.telegram.org/bots/api#getchat . More...
 
std::string bio
 Optional. Bio of the other party in a private chat. Returned only in getChat. More...
 
bool hasPrivateForwards {}
 Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat. More...
 
bool hasRestrictedVoiceAndVideoMessages {}
 Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat. More...
 
bool joinToSendMessages {}
 Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat. More...
 
bool joinByRequest {}
 Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. More...
 
std::string description
 Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. More...
 
std::string inviteLink
 Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. More...
 
Ptr< MessagepinnedMessage
 Optional. The most recent pinned message (by sending date). Returned only in getChat. More...
 
Ptr< ChatPermissionspermissions
 Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. More...
 
std::int32_t slowModeDelay {}
 Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. Returned only in getChat. More...
 
std::int32_t unrestrictBoostCount {}
 Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat. More...
 
std::int32_t messageAutoDeleteTime {}
 Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. More...
 
bool hasAggressiveAntiSpamEnabled {}
 Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. More...
 
bool hasHiddenMembers {}
 Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat. More...
 
bool hasProtectedContent {}
 Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. More...
 
bool hasVisibleHistory {}
 Optional. True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat. More...
 
std::string stickerSetName
 Optional. For supergroups, name of group sticker set. Returned only in getChat. More...
 
bool canSetStickerSet {}
 Optional. True, if the bot can change the group sticker set. Returned only in getChat. More...
 
std::int64_t linkedChatId {}
 Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat. More...
 
Ptr< ChatLocationlocation
 Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. More...
 

Static Public Attributes

static constexpr const char * Type2Str []
 

Detailed Description

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

Definition at line 12 of file Chat.hpp.

Member Enumeration Documentation

◆ Type

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

Enum of possible types of a chat.

Enumerator
Private 
Group 
Supergroup 
Channel 

Definition at line 25 of file Chat.hpp.

Constructor & Destructor Documentation

◆ Chat() [1/2]

tgbotxx::Chat::Chat ( )
default

◆ Chat() [2/2]

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

Definition at line 14 of file Chat.hpp.

Member Function Documentation

◆ fromJson()

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

Deserializes this object from JSON.

Definition at line 199 of file Chat.hpp.

◆ Str2Type()

static constexpr Type tgbotxx::Chat::Str2Type ( const std::string &  str)
inlinestaticconstexpr

Definition at line 33 of file Chat.hpp.

◆ toJson()

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

Serializes this object to JSON.

Returns
JSON representation of this object

Definition at line 158 of file Chat.hpp.

Member Data Documentation

◆ accentColorId

std::int32_t tgbotxx::Chat::accentColorId {}

Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. Always returned in getChat.

Definition at line 73 of file Chat.hpp.

◆ activeUsernames

std::vector<std::string> tgbotxx::Chat::activeUsernames

Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat.

Definition at line 66 of file Chat.hpp.

◆ availableReactions

std::vector<Ptr<ReactionType> > tgbotxx::Chat::availableReactions

Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat.

Definition at line 69 of file Chat.hpp.

◆ backgroundCustomEmojiId

std::string tgbotxx::Chat::backgroundCustomEmojiId

Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat.

Definition at line 76 of file Chat.hpp.

◆ bio

std::string tgbotxx::Chat::bio

Optional. Bio of the other party in a private chat. Returned only in getChat.

Definition at line 93 of file Chat.hpp.

◆ canSetStickerSet

bool tgbotxx::Chat::canSetStickerSet {}

Optional. True, if the bot can change the group sticker set. Returned only in getChat.

Definition at line 144 of file Chat.hpp.

◆ description

std::string tgbotxx::Chat::description

Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.

Definition at line 108 of file Chat.hpp.

◆ emojiStatusCustomEmojiId

std::string tgbotxx::Chat::emojiStatusCustomEmojiId

Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. https://core.telegram.org/bots/api#getchat .

Definition at line 86 of file Chat.hpp.

◆ emojiStatusExpirationDate

std::time_t tgbotxx::Chat::emojiStatusExpirationDate {}

Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. https://core.telegram.org/bots/api#getchat .

Definition at line 90 of file Chat.hpp.

◆ firstName

std::string tgbotxx::Chat::firstName

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

Definition at line 53 of file Chat.hpp.

◆ hasAggressiveAntiSpamEnabled

bool tgbotxx::Chat::hasAggressiveAntiSpamEnabled {}

Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat.

Definition at line 129 of file Chat.hpp.

◆ hasHiddenMembers

bool tgbotxx::Chat::hasHiddenMembers {}

Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat.

Definition at line 132 of file Chat.hpp.

◆ hasPrivateForwards

bool tgbotxx::Chat::hasPrivateForwards {}

Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.

Definition at line 96 of file Chat.hpp.

◆ hasProtectedContent

bool tgbotxx::Chat::hasProtectedContent {}

Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.

Definition at line 135 of file Chat.hpp.

◆ hasRestrictedVoiceAndVideoMessages

bool tgbotxx::Chat::hasRestrictedVoiceAndVideoMessages {}

Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.

Definition at line 99 of file Chat.hpp.

◆ hasVisibleHistory

bool tgbotxx::Chat::hasVisibleHistory {}

Optional. True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat.

Definition at line 138 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 22 of file Chat.hpp.

◆ inviteLink

std::string tgbotxx::Chat::inviteLink

Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.

Definition at line 111 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 60 of file Chat.hpp.

◆ joinByRequest

bool tgbotxx::Chat::joinByRequest {}

Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.

Definition at line 105 of file Chat.hpp.

◆ joinToSendMessages

bool tgbotxx::Chat::joinToSendMessages {}

Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.

Definition at line 102 of file Chat.hpp.

◆ lastName

std::string tgbotxx::Chat::lastName

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

Definition at line 56 of file Chat.hpp.

◆ linkedChatId

std::int64_t tgbotxx::Chat::linkedChatId {}

Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.

Definition at line 150 of file Chat.hpp.

◆ location

Ptr<ChatLocation> tgbotxx::Chat::location

Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.

Definition at line 153 of file Chat.hpp.

◆ messageAutoDeleteTime

std::int32_t tgbotxx::Chat::messageAutoDeleteTime {}

Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.

Definition at line 126 of file Chat.hpp.

◆ permissions

Ptr<ChatPermissions> tgbotxx::Chat::permissions

Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.

Definition at line 117 of file Chat.hpp.

◆ photo

Ptr<ChatPhoto> tgbotxx::Chat::photo

Optional. Chat photo. Returned only in getChat.

Definition at line 63 of file Chat.hpp.

◆ pinnedMessage

Ptr<Message> tgbotxx::Chat::pinnedMessage

Optional. The most recent pinned message (by sending date). Returned only in getChat.

Definition at line 114 of file Chat.hpp.

◆ profileAccentColorId

std::int32_t tgbotxx::Chat::profileAccentColorId {}

Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat.

Definition at line 79 of file Chat.hpp.

◆ profileBackgroundCustomEmojiId

std::string tgbotxx::Chat::profileBackgroundCustomEmojiId

Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat.

Definition at line 82 of file Chat.hpp.

◆ slowModeDelay

std::int32_t tgbotxx::Chat::slowModeDelay {}

Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. Returned only in getChat.

Definition at line 120 of file Chat.hpp.

◆ stickerSetName

std::string tgbotxx::Chat::stickerSetName

Optional. For supergroups, name of group sticker set. Returned only in getChat.

Definition at line 141 of file Chat.hpp.

◆ title

std::string tgbotxx::Chat::title

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

Definition at line 47 of file Chat.hpp.

◆ type

Type tgbotxx::Chat::type {}

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

Definition at line 44 of file Chat.hpp.

◆ Type2Str

constexpr const char* tgbotxx::Chat::Type2Str[]
inlinestaticconstexpr
Initial value:
= {
"private", "group", "supergroup", "channel"}

Definition at line 31 of file Chat.hpp.

◆ unrestrictBoostCount

std::int32_t tgbotxx::Chat::unrestrictBoostCount {}

Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat.

Definition at line 123 of file Chat.hpp.

◆ username

std::string tgbotxx::Chat::username

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

Definition at line 50 of file Chat.hpp.


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