Add sponsoredMessage.can_be_reported.

This commit is contained in:
levlam 2024-03-23 23:52:06 +03:00
parent 7ea8f7085d
commit 632f1aaec6
2 changed files with 14 additions and 9 deletions

View File

@ -1546,11 +1546,12 @@ messageSponsor type:MessageSponsorType photo:chatPhotoInfo info:string = Message
//@description Describes a sponsored 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 //@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" //@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 //@content Content of the message. Currently, can be only of the type messageText
//@sponsor Information about the sponsor of the message //@sponsor Information about the sponsor of the message
//@button_text If non-empty, text for the message action button //@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 //@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 //@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<sponsoredMessage> messages_between:int32 = SponsoredMessages; sponsoredMessages messages:vector<sponsoredMessage> messages_between:int32 = SponsoredMessages;

View File

@ -129,6 +129,7 @@ class ClickSponsoredMessageQuery final : public Td::ResultHandler {
struct SponsoredMessageManager::SponsoredMessage { struct SponsoredMessageManager::SponsoredMessage {
int64 local_id = 0; int64 local_id = 0;
bool is_recommended = false; bool is_recommended = false;
bool can_be_reported = false;
bool show_dialog_photo = false; bool show_dialog_photo = false;
DialogId sponsor_dialog_id; DialogId sponsor_dialog_id;
ServerMessageId server_message_id; ServerMessageId server_message_id;
@ -143,12 +144,14 @@ struct SponsoredMessageManager::SponsoredMessage {
string site_name; string site_name;
DialogPhoto site_photo; DialogPhoto site_photo;
SponsoredMessage(int64 local_id, bool is_recommended, bool show_dialog_photo, DialogId sponsor_dialog_id, SponsoredMessage(int64 local_id, bool is_recommended, bool can_be_reported, bool show_dialog_photo,
ServerMessageId server_message_id, string start_param, string invite_hash, WebApp web_app, DialogId sponsor_dialog_id, ServerMessageId server_message_id, string start_param,
unique_ptr<MessageContent> content, string button_text, string sponsor_info, string additional_info, string invite_hash, WebApp web_app, unique_ptr<MessageContent> content, string button_text,
string site_url, string site_name, DialogPhoto site_photo) string sponsor_info, string additional_info, string site_url, string site_name,
DialogPhoto site_photo)
: local_id(local_id) : local_id(local_id)
, is_recommended(is_recommended) , is_recommended(is_recommended)
, can_be_reported(can_be_reported)
, show_dialog_photo(show_dialog_photo) , show_dialog_photo(show_dialog_photo)
, sponsor_dialog_id(sponsor_dialog_id) , sponsor_dialog_id(sponsor_dialog_id)
, server_message_id(server_message_id) , server_message_id(server_message_id)
@ -303,7 +306,7 @@ td_api::object_ptr<td_api::sponsoredMessage> SponsoredMessageManager::get_sponso
return nullptr; return nullptr;
} }
return td_api::make_object<td_api::sponsoredMessage>( return td_api::make_object<td_api::sponsoredMessage>(
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), 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); 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<telegram_api::botApp>(sponsored_message->app_), dialog_id); web_app = WebApp(td_, telegram_api::move_object_as<telegram_api::botApp>(sponsored_message->app_), dialog_id);
} }
messages->messages.emplace_back( messages->messages.emplace_back(
local_id, sponsored_message->recommended_, sponsored_message->show_peer_photo_, sponsor_dialog_id, local_id, sponsored_message->recommended_, sponsored_message->can_report_,
server_message_id, std::move(sponsored_message->start_param_), std::move(invite_hash), std::move(web_app), sponsored_message->show_peer_photo_, sponsor_dialog_id, server_message_id,
std::move(content), std::move(sponsored_message->button_text_), std::move(sponsored_message->sponsor_info_), 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(sponsored_message->additional_info_), std::move(site_url), std::move(site_name),
std::move(site_photo)); std::move(site_photo));
} }