tgbotxx  1.1.6.9
Telegram Bot C++ Library
MessageReactionCountUpdated.hpp
Go to the documentation of this file.
1 #pragma once
6 
7 namespace tgbotxx {
12  explicit MessageReactionCountUpdated(const nl::json& json) {
13  fromJson(json);
14  }
15 
18 
20  std::int32_t messageId{};
21 
23  std::time_t date{};
24 
26  std::vector<Ptr<ReactionCount>> reactions;
27 
28 
31  nl::json toJson() const {
32  nl::json json = nl::json::object();
33  OBJECT_SERIALIZE_FIELD_PTR(json, "chat", chat);
34  OBJECT_SERIALIZE_FIELD(json, "message_id", messageId);
35  OBJECT_SERIALIZE_FIELD(json, "date", date);
36  OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, "reactions", reactions);
37  return json;
38  }
39 
41  void fromJson(const nl::json& json) {
42  OBJECT_DESERIALIZE_FIELD_PTR(json, "chat", chat, false);
43  OBJECT_DESERIALIZE_FIELD(json, "message_id", messageId, 0, false);
44  OBJECT_DESERIALIZE_FIELD(json, "date", date, 0, false);
45  OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, "reactions", reactions, false);
46  }
47  };
48 }
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition: Object.hpp:22
#define OBJECT_SERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field)
Definition: Object.hpp:27
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition: Object.hpp:70
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition: Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition: Object.hpp:44
#define OBJECT_DESERIALIZE_FIELD_PTR_ARRAY(json, json_field, array_field, optional)
Definition: Object.hpp:87
Definition: Api.hpp:14
std::shared_ptr< T > Ptr
Definition: Ptr.hpp:6
This object represents reaction changes on a message with anonymous reactions. https://core....
std::time_t date
Date of the change in Unix time.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Ptr< Chat > chat
The chat containing the message.
std::vector< Ptr< ReactionCount > > reactions
List of reactions that are present on the message.
nl::json toJson() const
Serializes this object to JSON.
std::int32_t messageId
Unique message identifier inside the chat.