tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
DirectMessagePriceChanged.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
9 explicit DirectMessagePriceChanged(const nl::json& json) {
10 fromJson(json);
11 }
12
15
17 std::int64_t directMessageStarCount{};
18
21 nl::json toJson() const {
22 nl::json json = nl::json::object();
23 OBJECT_SERIALIZE_FIELD(json, "are_direct_messages_enabled", areDirectMessagesEnabled);
24 OBJECT_SERIALIZE_FIELD(json, "direct_message_star_count", directMessageStarCount);
25 return json;
26 }
28 void fromJson(const nl::json& json) {
29 OBJECT_DESERIALIZE_FIELD(json, "are_direct_messages_enabled", areDirectMessagesEnabled, false, false);
30 OBJECT_DESERIALIZE_FIELD(json, "direct_message_star_count", directMessageStarCount, 0, true);
31 }
32 };
33}
#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
Describes a service message about a change in the price of direct messages sent to a channel chat....
nl::json toJson() const
Serializes this object to JSON.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
std::int64_t directMessageStarCount
Optional. The new number of Telegram Stars that must be paid by users for each direct message.
bool areDirectMessagesEnabled
True, if direct messages are enabled for the channel chat; false otherwise.