diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 43c3138cd..1bad22b84 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1546,11 +1546,12 @@ messageSponsor type:MessageSponsorType photo:chatPhotoInfo info:string = Message //@description Describes a sponsored message //@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages //@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" +//@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage //@content Content of the message. Currently, can be only of the type messageText //@sponsor Information about the sponsor of the message //@button_text If non-empty, text for the message action button //@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage message_id:int53 is_recommended:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; +sponsoredMessage message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor button_text:string additional_info:string = SponsoredMessage; //@description Contains a list of sponsored messages @messages List of sponsored messages @messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages sponsoredMessages messages:vector messages_between:int32 = SponsoredMessages; diff --git a/td/telegram/SponsoredMessageManager.cpp b/td/telegram/SponsoredMessageManager.cpp index 94859b86d..e09f857f4 100644 --- a/td/telegram/SponsoredMessageManager.cpp +++ b/td/telegram/SponsoredMessageManager.cpp @@ -129,6 +129,7 @@ class ClickSponsoredMessageQuery final : public Td::ResultHandler { struct SponsoredMessageManager::SponsoredMessage { int64 local_id = 0; bool is_recommended = false; + bool can_be_reported = false; bool show_dialog_photo = false; DialogId sponsor_dialog_id; ServerMessageId server_message_id; @@ -143,12 +144,14 @@ struct SponsoredMessageManager::SponsoredMessage { string site_name; DialogPhoto site_photo; - SponsoredMessage(int64 local_id, bool is_recommended, bool show_dialog_photo, DialogId sponsor_dialog_id, - ServerMessageId server_message_id, string start_param, string invite_hash, WebApp web_app, - unique_ptr content, string button_text, string sponsor_info, string additional_info, - string site_url, string site_name, DialogPhoto site_photo) + SponsoredMessage(int64 local_id, bool is_recommended, bool can_be_reported, bool show_dialog_photo, + DialogId sponsor_dialog_id, ServerMessageId server_message_id, string start_param, + string invite_hash, WebApp web_app, unique_ptr content, string button_text, + string sponsor_info, string additional_info, string site_url, string site_name, + DialogPhoto site_photo) : local_id(local_id) , is_recommended(is_recommended) + , can_be_reported(can_be_reported) , show_dialog_photo(show_dialog_photo) , sponsor_dialog_id(sponsor_dialog_id) , server_message_id(server_message_id) @@ -303,7 +306,7 @@ td_api::object_ptr SponsoredMessageManager::get_sponso return nullptr; } return td_api::make_object( - sponsored_message.local_id, sponsored_message.is_recommended, + sponsored_message.local_id, sponsored_message.is_recommended, sponsored_message.can_be_reported, get_message_content_object(sponsored_message.content.get(), td_, dialog_id, 0, false, true, -1, false, false), std::move(sponsor), sponsored_message.button_text, sponsored_message.additional_info); } @@ -456,9 +459,10 @@ void SponsoredMessageManager::on_get_dialog_sponsored_messages( web_app = WebApp(td_, telegram_api::move_object_as(sponsored_message->app_), dialog_id); } messages->messages.emplace_back( - local_id, sponsored_message->recommended_, sponsored_message->show_peer_photo_, sponsor_dialog_id, - server_message_id, std::move(sponsored_message->start_param_), std::move(invite_hash), std::move(web_app), - std::move(content), std::move(sponsored_message->button_text_), std::move(sponsored_message->sponsor_info_), + local_id, sponsored_message->recommended_, sponsored_message->can_report_, + sponsored_message->show_peer_photo_, sponsor_dialog_id, server_message_id, + std::move(sponsored_message->start_param_), std::move(invite_hash), std::move(web_app), std::move(content), + std::move(sponsored_message->button_text_), std::move(sponsored_message->sponsor_info_), std::move(sponsored_message->additional_info_), std::move(site_url), std::move(site_name), std::move(site_photo)); }