Rename message.ttl to self_destruct_timer.

This commit is contained in:
levlam 2022-12-28 17:09:39 +03:00
parent 1ff40ce132
commit 36fc74ea7c
3 changed files with 26 additions and 26 deletions

View File

@ -1058,8 +1058,8 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool n
//@reply_in_chat_id If non-zero, the identifier of the chat to which the replied message belongs; Currently, only 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
//@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 self-destruct timer, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires
//@ttl_expires_in Time left before the message expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the ttl field
//@self_destruct_timer The message's self-destruct timer, 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_timer field
//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_timer 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
@ -1067,7 +1067,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 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;
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 self_destruct_timer: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;
@ -2262,7 +2262,7 @@ messageDocument document:document caption:formattedText = MessageContent;
//@is_secret True, if the photo must be blurred and must be shown only while tapped
messagePhoto photo:photo caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent;
//@description An expired photo message (self-destructed after TTL has elapsed)
//@description A self-destructed photo message
messageExpiredPhoto = MessageContent;
//@description A sticker message @sticker The sticker description @is_premium True, if premium animation of the sticker must be played
@ -2275,7 +2275,7 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent;
//@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped
messageVideo video:video caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent;
//@description An expired video message (self-destructed after TTL has elapsed)
//@description A self-destructed video message
messageExpiredVideo = MessageContent;
//@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped
@ -2605,9 +2605,9 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content
//@width Photo width
//@height Photo height
//@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters
//@ttl Photo self-destruct timer, in seconds (0-60). A non-zero self-destruct timer can be specified only in private chats
//@self_destruct_timer Photo self-destruct timer, in seconds (0-60). A non-zero self-destruct timer can be specified only in private chats
//@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats
inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> width:int32 height:int32 caption:formattedText ttl:int32 has_spoiler:Bool = InputMessageContent;
inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> width:int32 height:int32 caption:formattedText self_destruct_timer:int32 has_spoiler:Bool = InputMessageContent;
//@description A sticker message
//@sticker Sticker to be sent
@ -2626,9 +2626,9 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh
//@height Video height
//@supports_streaming True, if the video is supposed to be streamed
//@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters
//@ttl Video self-destruct timer, in seconds (0-60). A non-zero self-destruct timer can be specified only in private chats
//@self_destruct_timer Video self-destruct timer, in seconds (0-60). A non-zero self-destruct timer can be specified only in private chats
//@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats
inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText ttl:int32 has_spoiler:Bool = InputMessageContent;
inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText self_destruct_timer:int32 has_spoiler:Bool = InputMessageContent;
//@description A video note message
//@video_note Video note to be sent

View File

@ -1967,7 +1967,7 @@ static Result<InputMessageContent> create_input_message_content(
if (input_photo->height_ < 0 || input_photo->height_ > 10000) {
return Status::Error(400, "Wrong photo height");
}
ttl = input_photo->ttl_;
ttl = input_photo->self_destruct_timer_;
auto message_photo = make_unique<MessagePhoto>();
@ -2029,7 +2029,7 @@ static Result<InputMessageContent> create_input_message_content(
case td_api::inputMessageVideo::ID: {
auto input_video = static_cast<td_api::inputMessageVideo *>(input_message_content.get());
ttl = input_video->ttl_;
ttl = input_video->self_destruct_timer_;
bool has_stickers = !sticker_file_ids.empty();
td->videos_manager_->create_video(

View File

@ -3696,7 +3696,7 @@ class CliClient final : public Actor {
if (op[3] == 'p') {
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
as_local_file("rgb.jpg"), nullptr, Auto(), 0, 0, as_caption(message),
message_auto_delete_timer_, has_spoiler_));
message_self_destruct_timer_, has_spoiler_));
} else {
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), false, true));
}
@ -3715,8 +3715,8 @@ class CliClient final : public Actor {
get_args(args, message_thread_id_);
} else if (op == "shs") {
has_spoiler_ = as_bool(args);
} else if (op == "smadt") {
message_auto_delete_timer_ = to_integer<int32>(args);
} else if (op == "smsdt") {
message_self_destruct_timer_ = to_integer<int32>(args);
} else if (op == "gcams") {
ChatId chat_id;
get_args(args, chat_id);
@ -3773,7 +3773,7 @@ class CliClient final : public Actor {
}
auto input_message_contents = transform(full_split(args), [this](const string &photo) {
td_api::object_ptr<td_api::InputMessageContent> content = td_api::make_object<td_api::inputMessagePhoto>(
as_input_file(photo), nullptr, Auto(), 0, 0, as_caption(""), rand_bool() ? message_auto_delete_timer_ : 0,
as_input_file(photo), nullptr, Auto(), 0, 0, as_caption(""), rand_bool() ? message_self_destruct_timer_ : 0,
has_spoiler_ && rand_bool());
return content;
});
@ -3853,7 +3853,7 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::editMessageMedia>(
chat_id, message_id, nullptr,
td_api::make_object<td_api::inputMessagePhoto>(as_input_file(photo), as_input_thumbnail(photo), Auto(), 0, 0,
as_caption(""), message_auto_delete_timer_, has_spoiler_)));
as_caption(""), message_self_destruct_timer_, has_spoiler_)));
} else if (op == "emvt") {
ChatId chat_id;
MessageId message_id;
@ -3863,7 +3863,7 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::editMessageMedia>(
chat_id, message_id, nullptr,
td_api::make_object<td_api::inputMessageVideo>(as_input_file(video), as_input_thumbnail(thumbnail), Auto(), 1,
2, 3, true, as_caption(""), message_auto_delete_timer_,
2, 3, true, as_caption(""), message_self_destruct_timer_,
has_spoiler_)));
} else if (op == "emll") {
ChatId chat_id;
@ -4180,7 +4180,7 @@ class CliClient final : public Actor {
get_args(args, chat_id, photo, caption, sticker_file_ids);
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
as_input_file(photo), nullptr, to_integers<int32>(sticker_file_ids), 0, 0,
as_caption(caption), message_auto_delete_timer_, has_spoiler_));
as_caption(caption), message_self_destruct_timer_, has_spoiler_));
} else if (op == "spg") {
ChatId chat_id;
string photo_path;
@ -4189,7 +4189,7 @@ class CliClient final : public Actor {
get_args(args, chat_id, photo_path, conversion, expected_size);
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
as_generated_file(photo_path, conversion, expected_size), nullptr, vector<int32>(), 0,
0, as_caption(""), message_auto_delete_timer_, has_spoiler_));
0, as_caption(""), message_self_destruct_timer_, has_spoiler_));
} else if (op == "spt") {
ChatId chat_id;
string photo_path;
@ -4197,7 +4197,7 @@ class CliClient final : public Actor {
get_args(args, chat_id, photo_path, thumbnail_path);
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
as_input_file(photo_path), as_input_thumbnail(thumbnail_path, 90, 89), vector<int32>(),
0, 0, as_caption(""), message_auto_delete_timer_, has_spoiler_));
0, 0, as_caption(""), message_self_destruct_timer_, has_spoiler_));
} else if (op == "sptg") {
ChatId chat_id;
string photo_path;
@ -4207,7 +4207,7 @@ class CliClient final : public Actor {
send_message(chat_id,
td_api::make_object<td_api::inputMessagePhoto>(
as_input_file(photo_path), as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89),
vector<int32>(), 0, 0, as_caption(""), message_auto_delete_timer_, has_spoiler_));
vector<int32>(), 0, 0, as_caption(""), message_self_destruct_timer_, has_spoiler_));
} else if (op == "spgtg") {
ChatId chat_id;
string photo_path;
@ -4218,14 +4218,14 @@ class CliClient final : public Actor {
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
as_generated_file(photo_path, conversion),
as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89), vector<int32>(), 0, 0,
as_caption(""), message_auto_delete_timer_, has_spoiler_));
as_caption(""), message_self_destruct_timer_, has_spoiler_));
} else if (op == "spid") {
ChatId chat_id;
string file_id;
get_args(args, chat_id, file_id);
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(as_input_file_id(file_id), nullptr,
vector<int32>(), 0, 0, as_caption(""),
message_auto_delete_timer_, has_spoiler_));
message_self_destruct_timer_, has_spoiler_));
} else if (op == "ss") {
ChatId chat_id;
string sticker_path;
@ -4259,7 +4259,7 @@ class CliClient final : public Actor {
}
send_message(chat_id, td_api::make_object<td_api::inputMessageVideo>(
as_input_file(video_path), nullptr, std::move(sticker_file_ids), 1, 2, 3, true,
as_caption(""), message_auto_delete_timer_, has_spoiler_));
as_caption(""), message_self_destruct_timer_, has_spoiler_));
} else if (op == "svt") {
ChatId chat_id;
string video;
@ -4267,7 +4267,7 @@ class CliClient final : public Actor {
get_args(args, chat_id, video, thumbnail);
send_message(chat_id, td_api::make_object<td_api::inputMessageVideo>(
as_input_file(video), as_input_thumbnail(thumbnail), vector<int32>(), 0, 0, 0, true,
as_caption(""), message_auto_delete_timer_, has_spoiler_));
as_caption(""), message_self_destruct_timer_, has_spoiler_));
} else if (op == "svn") {
ChatId chat_id;
string video_path;
@ -5344,7 +5344,7 @@ class CliClient final : public Actor {
string schedule_date_;
MessageThreadId message_thread_id_;
bool has_spoiler_ = false;
int32 message_auto_delete_timer_ = 0;
int32 message_self_destruct_timer_ = 0;
int64 opened_chat_id_ = 0;
ConcurrentScheduler *scheduler_{nullptr};