Add separate message.auto_delete_in.

This commit is contained in:
levlam 2022-12-26 17:31:04 +03:00
parent 0a0387e8f5
commit dcd1e60910
2 changed files with 10 additions and 12 deletions

View File

@ -1060,13 +1060,14 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n
//@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
//@ttl For self-destructing messages, the message's TTL (Time To Live), in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the TTL expires
//@ttl_expires_in Time left before the message expires, in seconds. If the TTL timer isn't started yet, equals to the value of the ttl field
//@auto_delete_in Time left before the message will be automatically deleted by message_ttl setting of the chat, in seconds; 0 if never. TDLib will send updateDeleteMessages or updateMessageContent once the time expires
//@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent
//@author_signature For channel posts and anonymous group messages, optional author signature
//@media_album_id Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums
//@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 message_thread_id:int53 ttl:int32 ttl_expires_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_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 ttl:int32 ttl_expires_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

@ -25413,21 +25413,18 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
(!forward_info->from_dialog_id.is_valid() && !is_forward_info_sender_hidden(forward_info));
}
int32 ttl = m->ttl;
int32 ttl = for_event_log ? 0 : m->ttl;
double ttl_expires_in = 0;
if (!for_event_log) {
if (m->ttl_expires_at != 0) {
ttl_expires_in = clamp(m->ttl_expires_at - Time::now(), 1e-3, ttl - 1e-3);
ttl_expires_in = clamp(m->ttl_expires_at - Time::now(), 1e-3, m->ttl - 1e-3);
} else {
ttl_expires_in = ttl;
ttl_expires_in = m->ttl;
}
if (ttl == 0 && m->ttl_period != 0) {
ttl = m->ttl_period;
ttl_expires_in = clamp(m->date + m->ttl_period - G()->server_time(), 1e-3, ttl - 1e-3);
}
} else {
ttl = 0;
}
double auto_delete_in = for_event_log || m->ttl_period == 0
? 0.0
: clamp(m->date + m->ttl_period - G()->server_time(), 1e-3, m->ttl_period - 1e-3);
auto sender = get_message_sender_object_const(td_, m->sender_user_id, m->sender_dialog_id, source);
auto scheduling_state = is_scheduled ? get_message_scheduling_state_object(m->date) : nullptr;
auto forward_info = get_message_forward_info_object(m->forward_info);
@ -25468,14 +25465,14 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
reply_to_message_id = 0;
}
return make_tl_object<td_api::message>(
return td_api::make_object<td_api::message>(
m->message_id.get(), std::move(sender), dialog_id.get(), 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, contains_unread_mention, date, edit_date, std::move(forward_info),
std::move(interaction_info), std::move(unread_reactions), reply_in_dialog_id.get(), reply_to_message_id,
top_thread_message_id, ttl, ttl_expires_in, via_bot_user_id, m->author_signature, media_album_id,
top_thread_message_id, ttl, ttl_expires_in, auto_delete_in, via_bot_user_id, m->author_signature, media_album_id,
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
}