From 73b65fc99eab7e03281a59d64ee819b18067d566 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 23 Jun 2021 03:38:17 +0300 Subject: [PATCH] Support input field placehoder in ReplyMarkup. --- telegram-bot-api/Client.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 557348d..8b9b191 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -4652,6 +4652,7 @@ td::Result> Client::get_reply_markup(con td::Result> Client::get_reply_markup(JsonValue &&value) { td::vector>> rows; td::vector>> inline_rows; + Slice input_field_placeholder; bool resize = false; bool one_time = false; bool remove = false; @@ -4727,18 +4728,24 @@ td::Result> Client::get_reply_markup(Jso return Status::Error(400, "Field \"force_reply\" of the reply markup must be of the type Boolean"); } force_reply = field_value.second.get_boolean(); + } else if (field_value.first == "input_field_placeholder") { + if (field_value.second.type() != JsonValue::Type::String) { + return Status::Error(400, "Field \"input_field_placeholder\" of the reply markup must be of the type String"); + } + input_field_placeholder = field_value.second.get_string(); } } object_ptr result; if (!rows.empty()) { - result = make_object(std::move(rows), resize, one_time, is_personal, td::string()); + result = make_object(std::move(rows), resize, one_time, is_personal, + input_field_placeholder.str()); } else if (!inline_rows.empty()) { result = make_object(std::move(inline_rows)); } else if (remove) { result = make_object(is_personal); } else if (force_reply) { - result = make_object(is_personal, td::string()); + result = make_object(is_personal, input_field_placeholder.str()); } if (result == nullptr || result->get_id() != td_api::replyMarkupInlineKeyboard::ID) { unresolved_bot_usernames_.clear();