tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
InaccessibleMessage.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
9 InaccessibleMessage() = default;
10 explicit InaccessibleMessage(const nl::json& json) {
11 fromJson(json);
12 }
13
16
18 std::int32_t messageId{};
19
21 std::time_t date{};
22
25 nl::json toJson() const {
26 nl::json json = nl::json::object();
27 OBJECT_SERIALIZE_FIELD_PTR(json, "chat", chat);
28 OBJECT_SERIALIZE_FIELD(json, "message_id", messageId);
29 OBJECT_SERIALIZE_FIELD(json, "date", date);
30 return json;
31 }
32
34 void fromJson(const nl::json& json) {
35 OBJECT_DESERIALIZE_FIELD_PTR(json, "chat", chat, false);
36 OBJECT_DESERIALIZE_FIELD(json, "message_id", messageId, 0, false);
37 OBJECT_DESERIALIZE_FIELD(json, "date", date, 0, false);
38 }
39 };
40}
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition Object.hpp:22
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition Object.hpp:72
#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:46
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object describes a message that was deleted or is otherwise inaccessible to the bot....
void fromJson(const nl::json &json)
Deserializes this object from JSON.
InaccessibleMessage(const nl::json &json)
std::int32_t messageId
Unique message identifier inside the chat.
Ptr< Chat > chat
Chat the message belonged to.
std::time_t date
Always 0. The field can be used to differentiate regular and inaccessible messages.
nl::json toJson() const
Serializes this object to JSON.