diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 0a0f81b..5c79ff9 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -5249,8 +5249,9 @@ td::Result> Client::get_input_me return nullptr; } -td_api::object_ptr Client::get_message_send_options(bool disable_notification) { - return make_object(disable_notification, false, false, nullptr); +td_api::object_ptr Client::get_message_send_options(bool disable_notification, + bool protect_content) { + return make_object(disable_notification, false, protect_content, nullptr); } td::Result>> Client::get_inline_query_results( @@ -6846,6 +6847,7 @@ td::Status Client::process_send_media_group_query(PromisedQueryPtr &query) { auto reply_to_message_id = get_message_id(query.get(), "reply_to_message_id"); auto allow_sending_without_reply = to_bool(query->arg("allow_sending_without_reply")); auto disable_notification = to_bool(query->arg("disable_notification")); + auto protect_content = to_bool(query->arg("protect_content")); // TRY_RESULT(reply_markup, get_reply_markup(query.get())); auto reply_markup = nullptr; TRY_RESULT(input_message_contents, get_input_message_contents(query.get(), "media")); @@ -6853,9 +6855,10 @@ td::Status Client::process_send_media_group_query(PromisedQueryPtr &query) { resolve_reply_markup_bot_usernames( std::move(reply_markup), std::move(query), [this, chat_id = chat_id.str(), reply_to_message_id, allow_sending_without_reply, disable_notification, - input_message_contents = std::move(input_message_contents)](object_ptr reply_markup, - PromisedQueryPtr query) mutable { - auto on_success = [this, disable_notification, input_message_contents = std::move(input_message_contents), + protect_content, input_message_contents = std::move(input_message_contents)]( + object_ptr reply_markup, PromisedQueryPtr query) mutable { + auto on_success = [this, disable_notification, protect_content, + input_message_contents = std::move(input_message_contents), reply_markup = std::move(reply_markup)](int64 chat_id, int64 reply_to_message_id, PromisedQueryPtr query) mutable { auto it = yet_unsent_message_count_.find(chat_id); @@ -6863,10 +6866,11 @@ td::Status Client::process_send_media_group_query(PromisedQueryPtr &query) { return query->set_retry_after_error(60); } - send_request(make_object(chat_id, 0, reply_to_message_id, - get_message_send_options(disable_notification), - std::move(input_message_contents)), - std::make_unique(this, std::move(query))); + send_request( + make_object(chat_id, 0, reply_to_message_id, + get_message_send_options(disable_notification, protect_content), + std::move(input_message_contents)), + std::make_unique(this, std::move(query))); }; check_message(chat_id, reply_to_message_id, reply_to_message_id <= 0 || allow_sending_without_reply, AccessRights::Write, "replied message", std::move(query), std::move(on_success)); @@ -8184,6 +8188,7 @@ void Client::do_send_message(object_ptr input_messa auto reply_to_message_id = get_message_id(query.get(), "reply_to_message_id"); auto allow_sending_without_reply = to_bool(query->arg("allow_sending_without_reply")); auto disable_notification = to_bool(query->arg("disable_notification")); + auto protect_content = to_bool(query->arg("protect_content")); auto r_reply_markup = get_reply_markup(query.get()); if (r_reply_markup.is_error()) { return fail_query_with_error(std::move(query), 400, r_reply_markup.error().message()); @@ -8193,9 +8198,10 @@ void Client::do_send_message(object_ptr input_messa resolve_reply_markup_bot_usernames( std::move(reply_markup), std::move(query), [this, chat_id = chat_id.str(), reply_to_message_id, allow_sending_without_reply, disable_notification, - input_message_content = std::move(input_message_content)](object_ptr reply_markup, - PromisedQueryPtr query) mutable { - auto on_success = [this, disable_notification, input_message_content = std::move(input_message_content), + protect_content, input_message_content = std::move(input_message_content)]( + object_ptr reply_markup, PromisedQueryPtr query) mutable { + auto on_success = [this, disable_notification, protect_content, + input_message_content = std::move(input_message_content), reply_markup = std::move(reply_markup)](int64 chat_id, int64 reply_to_message_id, PromisedQueryPtr query) mutable { auto it = yet_unsent_message_count_.find(chat_id); @@ -8204,7 +8210,7 @@ void Client::do_send_message(object_ptr input_messa } send_request(make_object(chat_id, 0, reply_to_message_id, - get_message_send_options(disable_notification), + get_message_send_options(disable_notification, protect_content), std::move(reply_markup), std::move(input_message_content)), std::make_unique(this, std::move(query))); }; diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 6cd452f..fee9aad 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -412,7 +412,8 @@ class Client : public WebhookActor::Callback { td::Result>> get_input_message_contents( const Query *query, td::JsonValue &&value) const; - static object_ptr get_message_send_options(bool disable_notification); + static object_ptr get_message_send_options(bool disable_notification, + bool protect_content); static td::Result> get_poll_options(const Query *query);