Add td_api::MessageReplyTo.

This commit is contained in:
levlam 2023-06-07 20:32:52 +03:00
parent 38b8078779
commit 6116573a3b
2 changed files with 39 additions and 28 deletions

View File

@ -1128,6 +1128,17 @@ messageSendingStatePending sending_id:int32 = MessageSendingState;
messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool need_another_sender:Bool retry_after:double = MessageSendingState;
//@class MessageReplyTo @description Contains information about the message or the story a message is replying to
//@description Describes a replied message
//@chat_id The identifier of the chat to which the replied message belongs. For example, messages in the Replies chat are replies to messages in different chats
//@message_id The identifier of the replied message
messageReplyToMessage chat_id:int53 message_id:int53 = MessageReplyTo;
//@description Describes a replied story @sender_user_id The identifier of the sender of the replied story @story_id The identifier of the replied story
messageReplyToStory sender_user_id:int53 story_id:int53 = MessageReplyTo;
//@description Describes a message
//@id Message identifier; unique for the chat to which the message belongs
//@sender_id Identifier of the sender of the message
@ -1156,10 +1167,7 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n
//@forward_info Information about the initial message sender; may be null
//@interaction_info Information about interactions with the message; may be null
//@unread_reactions Information about unread reactions added to the message
//@reply_in_chat_id If non-zero, the identifier of the chat to which the replied message belongs. For example, messages in the Replies chat can have different reply_in_chat_id and chat_id
//@reply_to_message_id If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message
//@replied_story_sender_user_id If non-zero, the identifier of the sender of the story this message is replying to
//@replied_story_id If non-zero, the identifier of the story this message is replying to; can be the identifier of a deleted or an unaccessible message
//@reply_to Information about the message or the story this message is replying to; may be null if none
//@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs
//@self_destruct_time The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires
//@self_destruct_in Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field
@ -1170,7 +1178,7 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n
//@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
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_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 interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_in_chat_id:int53 reply_to_message_id:int53 replied_story_sender_user_id:int53 replied_story_id:int32 message_thread_id:int53 self_destruct_time:int32 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_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 interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_to:MessageReplyTo message_thread_id:int53 self_destruct_time:int32 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

@ -24101,7 +24101,7 @@ td_api::object_ptr<td_api::message> MessagesManager::get_dialog_event_log_messag
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, 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,
std::move(forward_info), std::move(interaction_info), Auto(), 0, 0, 0, 0, 0, 0, 0.0, 0.0, via_bot_user_id,
std::move(forward_info), std::move(interaction_info), Auto(), nullptr, 0, 0, 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));
}
@ -24175,21 +24175,31 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
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);
auto via_bot_user_id = td_->contacts_manager_->get_user_id_object(m->via_bot_user_id, "via_bot_user_id");
auto reply_to_message_id = m->reply_to_message_id.get();
auto reply_in_dialog_id =
reply_to_message_id == 0 ? DialogId() : (m->reply_in_dialog_id.is_valid() ? m->reply_in_dialog_id : dialog_id);
auto reply_to_story_id = m->reply_to_story_full_id.get_story_id().get();
int64 reply_to_story_sender_dialog_id = 0;
if (reply_to_story_id != 0) {
CHECK(m->reply_to_story_full_id.get_dialog_id().get_type() == DialogType::User);
reply_to_story_sender_dialog_id = td_->contacts_manager_->get_user_id_object(
m->reply_to_story_full_id.get_dialog_id().get_user_id(), "reply_to_story_sender_dialog_id");
}
auto reply_to = [&]() -> td_api::object_ptr<td_api::MessageReplyTo> {
if (m->reply_to_message_id != MessageId()) {
if (m->is_topic_message && m->reply_in_dialog_id == DialogId() &&
m->reply_to_message_id == m->top_thread_message_id && !td_->auth_manager_->is_bot()) {
return nullptr;
}
return td_api::make_object<td_api::messageReplyToMessage>(
get_chat_id_object(m->reply_in_dialog_id.is_valid() ? m->reply_in_dialog_id : dialog_id,
"messageReplyToMessage"),
m->reply_to_message_id.get());
}
if (m->reply_to_story_full_id.get_story_id() != StoryId()) {
CHECK(m->reply_to_story_full_id.get_dialog_id().get_type() == DialogType::User);
return td_api::make_object<td_api::messageReplyToStory>(
td_->contacts_manager_->get_user_id_object(m->reply_to_story_full_id.get_dialog_id().get_user_id(),
"messageReplyToStory"),
m->reply_to_story_full_id.get_story_id().get());
}
return nullptr;
}();
auto top_thread_message_id = m->top_thread_message_id.get();
auto date = is_scheduled ? 0 : m->date;
auto edit_date = m->hide_edit_date ? 0 : m->edit_date;
auto is_pinned = is_scheduled ? false : m->is_pinned;
auto has_timestamped_media = reply_to_message_id == 0 || m->max_own_media_timestamp >= 0;
auto has_timestamped_media = reply_to == nullptr || m->max_own_media_timestamp >= 0;
auto reply_markup = get_reply_markup_object(td_->contacts_manager_.get(), m->reply_markup);
auto live_location_date = m->is_failed_to_send ? 0 : m->date;
auto skip_bot_commands = need_skip_bot_commands(dialog_id, m);
@ -24197,23 +24207,16 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
auto content = get_message_content_object(m->content.get(), td_, dialog_id, live_location_date, m->is_content_secret,
skip_bot_commands, max_media_timestamp);
if (m->is_topic_message && reply_in_dialog_id == dialog_id && reply_to_message_id == top_thread_message_id &&
!td_->auth_manager_->is_bot()) {
reply_in_dialog_id = DialogId();
reply_to_message_id = 0;
}
return td_api::make_object<td_api::message>(
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, is_pinned, can_be_edited, can_be_forwarded,
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_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(interaction_info), std::move(unread_reactions),
get_chat_id_object(reply_in_dialog_id, "get_message_object reply"), reply_to_message_id,
reply_to_story_sender_dialog_id, reply_to_story_id, top_thread_message_id, m->ttl, ttl_expires_in, auto_delete_in,
via_bot_user_id, m->author_signature, m->media_album_id,
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
std::move(forward_info), std::move(interaction_info), std::move(unread_reactions), std::move(reply_to),
top_thread_message_id, m->ttl, ttl_expires_in, auto_delete_in, via_bot_user_id, m->author_signature,
m->media_album_id, get_restriction_reason_description(m->restriction_reasons), std::move(content),
std::move(reply_markup));
}
tl_object_ptr<td_api::messages> MessagesManager::get_messages_object(int32 total_count, DialogId dialog_id,