tgbotxx 1.2.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
ForceReply.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
16 ForceReply() = default;
17 explicit ForceReply(const nl::json& json) {
19 }
20
22 bool forceReply{};
23
26
31 bool selective{};
32
33
36 [[nodiscard]] nl::json toJson() const override {
37 nl::json json = nl::json::object();
38 OBJECT_SERIALIZE_FIELD(json, "force_reply", forceReply);
39 OBJECT_SERIALIZE_FIELD(json, "input_field_placeholder", inputFieldPlaceholder);
41 return json;
42 }
43
45 void fromJson(const nl::json& json) override {
46 OBJECT_DESERIALIZE_FIELD(json, "force_reply", forceReply, false, false);
47 OBJECT_DESERIALIZE_FIELD(json, "input_field_placeholder", inputFieldPlaceholder, "", true);
48 OBJECT_DESERIALIZE_FIELD(json, "selective", selective, false, true);
49 }
50 };
51}
#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
Upon receiving a message with this object, Telegram clients will display a reply interface to the use...
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
ForceReply(const nl::json &json)
nl::json toJson() const override
Serializes this object to JSON.
std::string inputFieldPlaceholder
Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters.
bool selective
Optional. Use this parameter if you want to force reply from specific users only. Targets:
bool forceReply
Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'.
The interface of reply markup objects InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove ...