Add Message.can_get_read_date.

This commit is contained in:
levlam 2024-01-09 13:50:11 +03:00
parent 5baf9f52f8
commit 5fc554166f
2 changed files with 8 additions and 3 deletions

View File

@ -1323,6 +1323,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag
//@can_get_added_reactions True, if the list of added reactions is available through getMessageAddedReactions
//@can_get_statistics True, if the message statistics are available through getMessageStatistics
//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory
//@can_get_read_date True, if read date of the message can be received through getMessageReadDate
//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers
//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink
//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions
@ -1348,7 +1349,7 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted
//@content Content of the message
//@reply_markup Reply markup for the message; may be null if none
message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic:SavedMessagesTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message;
message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic:SavedMessagesTopic self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message;
//@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null
messages total_count:int32 messages:vector<message> = Messages;

View File

@ -17165,6 +17165,9 @@ Status MessagesManager::can_get_message_read_date(DialogId dialog_id, const Mess
if (!m->is_outgoing) {
return Status::Error(400, "Can't get read date of incoming messages");
}
if (G()->unix_time() - m->date > td_->option_manager_->get_option_integer("pm_read_date_expire_period")) {
return Status::Error(400, "Message is too old");
}
if (dialog_id.get_type() != DialogType::User) {
return Status::Error(400, "Read date can be received only in private chats");
@ -23060,7 +23063,7 @@ td_api::object_ptr<td_api::message> MessagesManager::get_dialog_event_log_messag
return td_api::make_object<td_api::message>(
m->message_id.get(), std::move(sender), get_chat_id_object(dialog_id, "get_dialog_event_log_message_object"),
nullptr, nullptr, m->is_outgoing, m->is_pinned, false, false, false, can_be_saved, false, false, false, false,
false, false, false, false, true, m->is_channel_post, m->is_topic_message, false, m->date, edit_date,
false, false, false, false, false, true, m->is_channel_post, m->is_topic_message, false, m->date, edit_date,
std::move(forward_info), std::move(import_info), std::move(interaction_info), Auto(), nullptr, 0, nullptr,
nullptr, 0.0, 0.0, via_bot_user_id, m->author_signature, 0,
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
@ -23136,6 +23139,7 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
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();
auto can_get_read_date = can_get_message_read_date(dialog_id, m).is_ok();
auto can_get_viewers = can_get_message_viewers(dialog_id, m).is_ok();
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);
@ -23175,7 +23179,7 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
m->message_id.get(), std::move(sender), get_chat_id_object(dialog_id, "get_message_object"),
std::move(sending_state), std::move(scheduling_state), is_outgoing, m->is_pinned, can_be_edited, can_be_forwarded,
can_be_replied_in_another_chat, can_be_saved, can_delete_for_self, can_delete_for_all_users,
can_get_added_reactions, can_get_statistics, can_get_message_thread, can_get_viewers,
can_get_added_reactions, can_get_statistics, can_get_message_thread, can_get_read_date, can_get_viewers,
can_get_media_timestamp_links, can_report_reactions, has_timestamped_media, m->is_channel_post,
m->is_topic_message, m->contains_unread_mention, date, edit_date, std::move(forward_info), std::move(import_info),
std::move(interaction_info), std::move(unread_reactions), std::move(reply_to), top_thread_message_id,