tgbotxx  1.1.6.9
Telegram Bot C++ Library
ForceReply.hpp
Go to the documentation of this file.
1 #pragma once
3 
4 namespace tgbotxx {
16  ForceReply() = default;
17  explicit ForceReply(const nl::json& json) {
18  _fromJson(json);
19  }
20 
22  bool forceReply{};
23 
25  std::string inputFieldPlaceholder;
26 
31  bool selective{};
32 
33 
36  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);
40  OBJECT_SERIALIZE_FIELD(json, "selective", selective);
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  private:
53  void _fromJson(const nl::json& json) {
54  fromJson(json);
55  }
56  };
57 }
#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
Definition: Api.hpp:14
Upon receiving a message with this object, Telegram clients will display a reply interface to the use...
Definition: ForceReply.hpp:15
void fromJson(const nl::json &json) override
Deserializes this object from JSON.
Definition: ForceReply.hpp:45
ForceReply(const nl::json &json)
Definition: ForceReply.hpp:17
nl::json toJson() const override
Serializes this object to JSON.
Definition: ForceReply.hpp:36
std::string inputFieldPlaceholder
Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters.
Definition: ForceReply.hpp:25
bool selective
Optional. Use this parameter if you want to force reply from specific users only. Targets:
Definition: ForceReply.hpp:31
bool forceReply
Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'.
Definition: ForceReply.hpp:22
The interface of reply markup objects InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove ...
Definition: IReplyMarkup.hpp:7