Add messageProperties.can_be_replied.

This commit is contained in:
levlam 2024-07-08 15:22:14 +03:00
parent 80467af525
commit ba48f1b885
2 changed files with 17 additions and 10 deletions

View File

@ -1547,13 +1547,13 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo;
//@class InputMessageReplyTo @description Contains information about the message or the story to be replied
//@description Describes a message to be replied in the same chat and forum topic
//@message_id The identifier of the message to be replied in the same chat and forum topic
//@message_id The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if message.can_be_replied
//@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats
inputMessageReplyToMessage message_id:int53 quote:inputTextQuote = InputMessageReplyTo;
//@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats
//@chat_id The identifier of the chat to which the message to be replied belongs
//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat
//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if message.can_be_replied_in_another_chat
//@quote Quote from the message to be replied; pass null if none
inputMessageReplyToExternalMessage chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo;
@ -3833,7 +3833,8 @@ 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_replied_in_another_chat True, if the message can be replied in another chat or topic using inputMessageReplyToExternalMessage
//@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
//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options
//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions
@ -3843,7 +3844,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_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_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

View File

@ -17301,7 +17301,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
if (m == nullptr) {
if (message_id.is_valid_sponsored()) {
return promise.set_value(td_api::make_object<td_api::messageProperties>(
false, false, false, false, false, false, false, false, false, false, false, false, false, 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"));
}
@ -17311,8 +17311,9 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
bool is_from_saved_messages = (dialog_id == td_->dialog_manager_->get_my_dialog_id());
bool can_delete_for_self = false;
bool can_delete_for_all_users = can_delete && can_revoke_message(dialog_id, m);
auto dialog_type = dialog_id.get_type();
if (can_delete) {
switch (dialog_id.get_type()) {
switch (dialog_type) {
case DialogType::User:
case DialogType::Chat:
// TODO allow to delete yet unsent message just for self
@ -17336,8 +17337,12 @@ 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_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) &&
(dialog_type != DialogType::Chat || td_->chat_manager_->get_chat_is_active(dialog_id.get_chat_id()));
auto can_be_replied_in_another_chat = can_be_forwarded && m->message_id.is_server();
auto can_be_reported = dialog_id.get_type() != DialogType::SecretChat && can_report_message(m->message_id).is_ok();
auto can_be_reported = dialog_type != DialogType::SecretChat && can_report_message(m->message_id).is_ok();
auto can_get_added_reactions = m->reactions != nullptr && m->reactions->can_get_added_reactions_;
auto can_get_statistics = can_get_message_statistics(dialog_id, m);
auto can_get_message_thread = get_top_thread_message_full_id(dialog_id, m, false).is_ok();
@ -17346,9 +17351,10 @@ 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<td_api::messageProperties>(
can_delete_for_self, can_delete_for_all_users, can_be_edited, can_be_forwarded, 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));
can_delete_for_self, can_delete_for_all_users, can_be_edited, can_be_forwarded, 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));
}
bool MessagesManager::is_message_edited_recently(MessageFullId message_full_id, int32 seconds) {