14 explicit Chat(
const nl::json& json) {
25 enum class Type : std::uint8_t {
31 inline static constexpr
const char *
Type2Str[] = {
32 "private",
"group",
"supergroup",
"channel"};
37 return static_cast<Type>(i);
40 throw Exception(
"Could not convert Chat type string \"" + str +
"\" to enum Type");
159 nl::json json = nl::json::object();
161 json[
"type"] =
Type2Str[
static_cast<std::size_t
>(
type)];
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
This object represents a chat. https://core.telegram.org/bots/api#chat.
bool hasPrivateForwards
Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?...
std::time_t emojiStatusExpirationDate
Optional. Expiration date of the emoji status of the other party in a private chat in Unix time,...
bool hasAggressiveAntiSpamEnabled
Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only avail...
std::vector< std::string > activeUsernames
Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and cha...
Ptr< Message > pinnedMessage
Optional. The most recent pinned message (by sending date). Returned only in getChat.
std::string emojiStatusCustomEmojiId
Optional. Custom emoji identifier of emoji status of the other party in a private chat....
bool hasRestrictedVoiceAndVideoMessages
Optional. True, if the privacy settings of the other party restrict sending voice and video note mess...
std::string username
Optional. Username, for private chats, supergroups and channels if available.
std::string bio
Optional. Bio of the other party in a private chat. Returned only in getChat.
bool joinByRequest
Optional. True, if all users directly joining the supergroup need to be approved by supergroup admini...
bool hasProtectedContent
Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat...
std::int32_t messageAutoDeleteTime
Optional. The time after which all messages sent to the chat will be automatically deleted; in second...
std::string inviteLink
Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
Type
Enum of possible types of a chat.
bool isForum
Optional. True, if the supergroup chat is a forum (has topics enabled) https://telegram....
std::string backgroundCustomEmojiId
Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview b...
Ptr< ChatLocation > location
Optional. For supergroups, the location to which the supergroup is connected. Returned only in getCha...
static constexpr const char * Type2Str[]
std::vector< Ptr< ReactionType > > availableReactions
Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are a...
std::int32_t profileAccentColorId
Optional. Identifier of the accent color for the chat's profile background. See profile accent colors...
std::string lastName
Optional. Last name of the other party in a private chat.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Chat(const nl::json &json)
Ptr< ChatPermissions > permissions
Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
Type type
Type of chat, can be either “private”, “group”, “supergroup” or “channel”
std::string firstName
Optional. First name of the other party in a private chat.
nl::json toJson() const
Serializes this object to JSON.
std::int64_t linkedChatId
Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel a...
std::int32_t unrestrictBoostCount
Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in...
std::int32_t accentColorId
Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo,...
std::string title
Optional. Title, for supergroups, channels and group chats.
std::string description
Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
bool hasHiddenMembers
Optional. True, if non-administrators can only get the list of bots and administrators in the chat....
static constexpr Type Str2Type(const std::string &str)
std::string stickerSetName
Optional. For supergroups, name of group sticker set. Returned only in getChat.
Ptr< ChatPhoto > photo
Optional. Chat photo. Returned only in getChat.
bool joinToSendMessages
Optional. True, if users need to join the supergroup before they can send messages....
std::string profileBackgroundCustomEmojiId
Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background....
std::int32_t slowModeDelay
Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriv...
bool canSetStickerSet
Optional. True, if the bot can change the group sticker set. Returned only in getChat.
bool hasVisibleHistory
Optional. True, if new chat members will have access to old messages; available only to chat administ...