From 2782bf1095e7a671ab8df2af8ff76a6fdc3ece17 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 8 Jul 2024 15:38:20 +0300 Subject: [PATCH] Add messageProperties.can_be_paid. --- td/generate/scheme/td_api.tl | 3 ++- td/telegram/MessagesManager.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 5db4410a2..4e2f14d6d 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3833,6 +3833,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageMedia, editMessageCaption, or editMessageReplyMarkup. //-For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message //@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages +//@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage //@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage //@can_be_reported True, if the message can be reported using reportSupergroupSpam or reportChat @@ -3844,7 +3845,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop //@can_get_statistics True, if the message statistics are available through getMessageStatistics //@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers //@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions -messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_reported:Bool can_be_saved:Bool can_get_added_reactions:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_report_reactions:Bool = MessageProperties; +messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_reported:Bool can_be_saved:Bool can_get_added_reactions:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_report_reactions:Bool = MessageProperties; //@class SearchMessagesFilter @description Represents a filter for message search results diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 0fdbed5d1..498d34645 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -17300,8 +17300,9 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa const Message *m = get_message_force(d, message_id, "get_message_properties"); if (m == nullptr) { if (message_id.is_valid_sponsored()) { - return promise.set_value(td_api::make_object( - false, false, false, false, false, false, false, false, false, false, false, false, false, false, false)); + return promise.set_value(td_api::make_object(false, false, false, false, false, false, + false, false, false, false, false, false, + false, false, false, false)); } return promise.set_error(Status::Error(400, "Message not found")); } @@ -17337,6 +17338,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa auto can_be_saved = can_save_message(dialog_id, m); auto can_be_edited = can_edit_message(dialog_id, m, false, is_bot); auto can_be_forwarded = can_be_saved && can_forward_message(dialog_id, m); + auto can_be_paid = get_invoice_message_id({dialog_id, m->message_id}).is_ok(); auto can_be_replied = message_id.is_valid() && !(message_id == MessageId(ServerMessageId(1)) && dialog_type == DialogType::Channel) && m->message_id.is_yet_unsent() && (!m->message_id.is_local() || dialog_type == DialogType::SecretChat) && @@ -17351,7 +17353,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa auto can_get_media_timestamp_links = can_get_media_timestamp_link(dialog_id, m).is_ok(); auto can_report_reactions = can_report_message_reactions(dialog_id, m); promise.set_value(td_api::make_object( - can_delete_for_self, can_delete_for_all_users, can_be_edited, can_be_forwarded, can_be_replied, + can_delete_for_self, can_delete_for_all_users, can_be_edited, can_be_forwarded, can_be_paid, can_be_replied, can_be_replied_in_another_chat, can_be_reported, can_be_saved, can_get_added_reactions, can_get_media_timestamp_links, can_get_message_thread, can_get_read_date, can_get_statistics, can_get_viewers, can_report_reactions));