tgbotxx 1.2.9.5
Telegram Bot C++ Library
Loading...
Searching...
No Matches
ForumTopic.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
7 struct ForumTopic {
8 ForumTopic() = default;
9 explicit ForumTopic(const nl::json& json) {
11 }
12
14 std::int32_t messageThreadId{};
15
17 std::string name;
18
20 std::int32_t iconColor{};
21
23 std::string iconCustomEmojiId{};
24
27
30 nl::json toJson() const {
31 nl::json json = nl::json::object();
32 OBJECT_SERIALIZE_FIELD(json, "message_thread_id", messageThreadId);
35 OBJECT_SERIALIZE_FIELD(json, "icon_custom_emoji_id", iconCustomEmojiId);
36 OBJECT_SERIALIZE_FIELD(json, "is_name_implicit", isNameImplicit);
37 return json;
38 }
39
41 void fromJson(const nl::json& json) {
42 OBJECT_DESERIALIZE_FIELD(json, "message_thread_id", messageThreadId, 0, false);
43 OBJECT_DESERIALIZE_FIELD(json, "name", name, "", false);
44 OBJECT_DESERIALIZE_FIELD(json, "icon_color", iconColor, 0x000000, false);
45 OBJECT_DESERIALIZE_FIELD(json, "icon_custom_emoji_id", iconCustomEmojiId, "", true);
46 OBJECT_DESERIALIZE_FIELD(json, "is_name_implicit", isNameImplicit, false, true);
47 }
48 };
49}
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Serialize.
Definition Object.hpp:27
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:64
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object represents a forum topic. https://core.telegram.org/bots/api#forumtopic.
Definition ForumTopic.hpp:7
ForumTopic(const nl::json &json)
Definition ForumTopic.hpp:9
std::int32_t messageThreadId
Unique identifier of the forum topic.
std::int32_t iconColor
Color of the topic icon in RGB format.
nl::json toJson() const
Serializes this object to JSON.
bool isNameImplicit
Optional. True, if the name of the topic wasn't specified explicitly by its creator and likely needs ...
std::string name
Name of the topic.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::string iconCustomEmojiId
Optional. Unique identifier of the custom emoji shown as the topic icon.