Move only_preview to messageSendOptions.

This commit is contained in:
levlam 2023-10-23 18:40:55 +03:00
parent d9d3d492ff
commit faf964a10d
5 changed files with 42 additions and 43 deletions

View File

@ -2968,7 +2968,8 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType;
//@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum
//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled
//@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates
messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 = MessageSendOptions; //@only_preview Pass true to get a fake message instead of actually sending them
messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 only_preview:Bool = MessageSendOptions;
//@description Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied //@description Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied
//@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local
@ -6996,8 +6997,7 @@ sendMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo o
//@reply_to Identifier of the replied message or story; pass null if none //@reply_to Identifier of the replied message or story; pass null if none
//@options Options to be used to send the messages; pass null to use default options //@options Options to be used to send the messages; pass null to use default options
//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album //@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album
//@only_preview Pass true to get fake messages instead of actually sending them sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector<InputMessageContent> = Messages;
sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector<InputMessageContent> only_preview:Bool = Messages;
//@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message //@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message
//@bot_user_id Identifier of the bot //@bot_user_id Identifier of the bot
@ -7023,8 +7023,7 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:Inpu
//@options Options to be used to send the messages; pass null to use default options //@options Options to be used to send the messages; pass null to use default options
//@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local
//@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false
//@only_preview Pass true to get fake messages instead of actually forwarding them forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector<int53> options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages;
forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector<int53> options:messageSendOptions send_copy:Bool remove_caption:Bool only_preview:Bool = Messages;
//@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed.
//-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message //-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message

View File

@ -25030,6 +25030,7 @@ Result<MessagesManager::MessageSendOptions> MessagesManager::process_message_sen
result.update_stickersets_order = options->update_order_of_installed_sticker_sets_; result.update_stickersets_order = options->update_order_of_installed_sticker_sets_;
} }
result.protect_content = options->protect_content_; result.protect_content = options->protect_content_;
result.only_preview = options->only_preview_;
TRY_RESULT_ASSIGN(result.schedule_date, get_message_schedule_date(std::move(options->scheduling_state_))); TRY_RESULT_ASSIGN(result.schedule_date, get_message_schedule_date(std::move(options->scheduling_state_)));
result.sending_id = options->sending_id_; result.sending_id = options->sending_id_;
} }
@ -25123,7 +25124,7 @@ int64 MessagesManager::generate_new_media_album_id() {
Result<td_api::object_ptr<td_api::messages>> MessagesManager::send_message_group( Result<td_api::object_ptr<td_api::messages>> MessagesManager::send_message_group(
DialogId dialog_id, MessageId top_thread_message_id, td_api::object_ptr<td_api::InputMessageReplyTo> &&reply_to, DialogId dialog_id, MessageId top_thread_message_id, td_api::object_ptr<td_api::InputMessageReplyTo> &&reply_to,
tl_object_ptr<td_api::messageSendOptions> &&options, tl_object_ptr<td_api::messageSendOptions> &&options,
vector<tl_object_ptr<td_api::InputMessageContent>> &&input_message_contents, bool only_preview) { vector<tl_object_ptr<td_api::InputMessageContent>> &&input_message_contents) {
if (input_message_contents.size() > MAX_GROUPED_MESSAGES) { if (input_message_contents.size() > MAX_GROUPED_MESSAGES) {
return Status::Error(400, "Too many messages to send as an album"); return Status::Error(400, "Too many messages to send as an album");
} }
@ -25176,7 +25177,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::send_message_group
auto &message_content = message_contents[i]; auto &message_content = message_contents[i];
unique_ptr<Message> message; unique_ptr<Message> message;
Message *m; Message *m;
if (only_preview) { if (message_send_options.only_preview) {
message = create_message_to_send(d, top_thread_message_id, input_reply_to, message_send_options, message = create_message_to_send(d, top_thread_message_id, input_reply_to, message_send_options,
std::move(message_content.content), message_content.invert_media, i != 0, std::move(message_content.content), message_content.invert_media, i != 0,
nullptr, false, DialogId()); nullptr, false, DialogId());
@ -25201,7 +25202,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::send_message_group
result.push_back(get_message_object(dialog_id, m, "send_message_group")); result.push_back(get_message_object(dialog_id, m, "send_message_group"));
if (!only_preview) { if (!message_send_options.only_preview) {
save_send_message_log_event(dialog_id, m); save_send_message_log_event(dialog_id, m);
do_send_message(dialog_id, m); do_send_message(dialog_id, m);
@ -25212,7 +25213,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::send_message_group
} }
if (need_update_dialog_pos) { if (need_update_dialog_pos) {
CHECK(!only_preview); CHECK(!message_send_options.only_preview);
send_update_chat_last_message(d, "send_message_group"); send_update_chat_last_message(d, "send_message_group");
} }
@ -27688,7 +27689,7 @@ Result<td_api::object_ptr<td_api::message>> MessagesManager::forward_message(
vector<MessageCopyOptions> all_copy_options; vector<MessageCopyOptions> all_copy_options;
all_copy_options.push_back(std::move(copy_options)); all_copy_options.push_back(std::move(copy_options));
TRY_RESULT(result, forward_messages(to_dialog_id, top_thread_message_id, from_dialog_id, {message_id}, TRY_RESULT(result, forward_messages(to_dialog_id, top_thread_message_id, from_dialog_id, {message_id},
std::move(options), in_game_share, std::move(all_copy_options), false)); std::move(options), in_game_share, std::move(all_copy_options)));
CHECK(result->messages_.size() == 1); CHECK(result->messages_.size() == 1);
if (result->messages_[0] == nullptr) { if (result->messages_[0] == nullptr) {
return Status::Error(400, return Status::Error(400,
@ -28023,14 +28024,14 @@ Result<MessagesManager::ForwardedMessages> MessagesManager::get_forwarded_messag
Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages( Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
DialogId to_dialog_id, MessageId top_thread_message_id, DialogId from_dialog_id, vector<MessageId> message_ids, DialogId to_dialog_id, MessageId top_thread_message_id, DialogId from_dialog_id, vector<MessageId> message_ids,
tl_object_ptr<td_api::messageSendOptions> &&options, bool in_game_share, vector<MessageCopyOptions> &&copy_options, tl_object_ptr<td_api::messageSendOptions> &&options, bool in_game_share,
bool only_preview) { vector<MessageCopyOptions> &&copy_options) {
TRY_RESULT(forwarded_messages_info, TRY_RESULT(forwarded_messages_info,
get_forwarded_messages(to_dialog_id, top_thread_message_id, from_dialog_id, message_ids, get_forwarded_messages(to_dialog_id, top_thread_message_id, from_dialog_id, message_ids,
std::move(options), in_game_share, std::move(copy_options))); std::move(options), in_game_share, std::move(copy_options)));
auto from_dialog = forwarded_messages_info.from_dialog; auto from_dialog = forwarded_messages_info.from_dialog;
auto to_dialog = forwarded_messages_info.to_dialog; auto to_dialog = forwarded_messages_info.to_dialog;
auto message_send_options = forwarded_messages_info.message_send_options; const auto message_send_options = forwarded_messages_info.message_send_options;
auto &copied_messages = forwarded_messages_info.copied_messages; auto &copied_messages = forwarded_messages_info.copied_messages;
auto &forwarded_message_contents = forwarded_messages_info.forwarded_message_contents; auto &forwarded_message_contents = forwarded_messages_info.forwarded_message_contents;
auto drop_author = forwarded_messages_info.drop_author; auto drop_author = forwarded_messages_info.drop_author;
@ -28063,7 +28064,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
unique_ptr<Message> message; unique_ptr<Message> message;
Message *m; Message *m;
if (only_preview) { if (message_send_options.only_preview) {
message = create_message_to_send( message = create_message_to_send(
to_dialog, top_thread_message_id, MessageInputReplyTo{reply_to_message_id}, message_send_options, to_dialog, top_thread_message_id, MessageInputReplyTo{reply_to_message_id}, message_send_options,
std::move(content), forwarded_message_contents[j].invert_media, j + 1 != forwarded_message_contents.size(), std::move(content), forwarded_message_contents[j].invert_media, j + 1 != forwarded_message_contents.size(),
@ -28087,7 +28088,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
m->real_forward_from_message_id = message_id; m->real_forward_from_message_id = message_id;
forwarded_message_id_to_new_message_id.emplace(message_id, m->message_id); forwarded_message_id_to_new_message_id.emplace(message_id, m->message_id);
if (!only_preview) { if (!message_send_options.only_preview) {
if (!td_->auth_manager_->is_bot()) { if (!td_->auth_manager_->is_bot()) {
send_update_new_message(to_dialog, m); send_update_new_message(to_dialog, m);
} }
@ -28099,7 +28100,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
} }
if (!forwarded_messages.empty()) { if (!forwarded_messages.empty()) {
CHECK(!only_preview); CHECK(!message_send_options.only_preview);
do_forward_messages(to_dialog_id, from_dialog_id, forwarded_messages, forwarded_message_ids, drop_author, do_forward_messages(to_dialog_id, from_dialog_id, forwarded_messages, forwarded_message_ids, drop_author,
drop_media_captions, 0); drop_media_captions, 0);
} }
@ -28127,7 +28128,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
unique_ptr<Message> message; unique_ptr<Message> message;
Message *m; Message *m;
if (only_preview) { if (message_send_options.only_preview) {
message = create_message_to_send(to_dialog, top_thread_message_id, input_reply_to, message_send_options, message = create_message_to_send(to_dialog, top_thread_message_id, input_reply_to, message_send_options,
std::move(copied_message.content), copied_message.invert_media, false, nullptr, std::move(copied_message.content), copied_message.invert_media, false, nullptr,
is_copy, DialogId()); is_copy, DialogId());
@ -28153,7 +28154,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
m->reply_markup = std::move(copied_message.reply_markup); m->reply_markup = std::move(copied_message.reply_markup);
forwarded_message_id_to_new_message_id[copied_message.original_message_id] = m->message_id; forwarded_message_id_to_new_message_id[copied_message.original_message_id] = m->message_id;
if (!only_preview) { if (!message_send_options.only_preview) {
save_send_message_log_event(to_dialog_id, m); save_send_message_log_event(to_dialog_id, m);
do_send_message(to_dialog_id, m); do_send_message(to_dialog_id, m);
if (!td_->auth_manager_->is_bot()) { if (!td_->auth_manager_->is_bot()) {
@ -28165,7 +28166,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
} }
if (need_update_dialog_pos) { if (need_update_dialog_pos) {
CHECK(!only_preview); CHECK(!message_send_options.only_preview);
send_update_chat_last_message(to_dialog, "forward_messages"); send_update_chat_last_message(to_dialog, "forward_messages");
} }
@ -28266,7 +28267,7 @@ Result<vector<MessageId>> MessagesManager::resend_messages(DialogId dialog_id, v
auto need_another_sender = auto need_another_sender =
message->send_error_code == 400 && message->send_error_message == CSlice("SEND_AS_PEER_INVALID"); message->send_error_code == 400 && message->send_error_message == CSlice("SEND_AS_PEER_INVALID");
MessageSendOptions options(message->disable_notification, message->from_background, MessageSendOptions options(message->disable_notification, message->from_background,
message->update_stickersets_order, message->noforwards, message->update_stickersets_order, message->noforwards, false,
get_message_schedule_date(message.get()), message->sending_id); get_message_schedule_date(message.get()), message->sending_id);
Message *m = Message *m =
get_message_to_send(d, message->top_thread_message_id, get_message_input_reply_to(message.get()), options, get_message_to_send(d, message->top_thread_message_id, get_message_input_reply_to(message.get()), options,

View File

@ -442,8 +442,7 @@ class MessagesManager final : public Actor {
Result<td_api::object_ptr<td_api::messages>> send_message_group( Result<td_api::object_ptr<td_api::messages>> send_message_group(
DialogId dialog_id, MessageId top_thread_message_id, td_api::object_ptr<td_api::InputMessageReplyTo> &&reply_to, DialogId dialog_id, MessageId top_thread_message_id, td_api::object_ptr<td_api::InputMessageReplyTo> &&reply_to,
tl_object_ptr<td_api::messageSendOptions> &&options, tl_object_ptr<td_api::messageSendOptions> &&options,
vector<tl_object_ptr<td_api::InputMessageContent>> &&input_message_contents, vector<tl_object_ptr<td_api::InputMessageContent>> &&input_message_contents) TD_WARN_UNUSED_RESULT;
bool only_preview) TD_WARN_UNUSED_RESULT;
Result<MessageId> send_bot_start_message(UserId bot_user_id, DialogId dialog_id, Result<MessageId> send_bot_start_message(UserId bot_user_id, DialogId dialog_id,
const string &parameter) TD_WARN_UNUSED_RESULT; const string &parameter) TD_WARN_UNUSED_RESULT;
@ -454,12 +453,10 @@ class MessagesManager final : public Actor {
int64 query_id, const string &result_id, int64 query_id, const string &result_id,
bool hide_via_bot) TD_WARN_UNUSED_RESULT; bool hide_via_bot) TD_WARN_UNUSED_RESULT;
Result<td_api::object_ptr<td_api::messages>> forward_messages(DialogId to_dialog_id, MessageId top_thread_message_id, Result<td_api::object_ptr<td_api::messages>> forward_messages(
DialogId from_dialog_id, vector<MessageId> message_ids, DialogId to_dialog_id, MessageId top_thread_message_id, DialogId from_dialog_id, vector<MessageId> message_ids,
tl_object_ptr<td_api::messageSendOptions> &&options, tl_object_ptr<td_api::messageSendOptions> &&options, bool in_game_share,
bool in_game_share, vector<MessageCopyOptions> &&copy_options) TD_WARN_UNUSED_RESULT;
vector<MessageCopyOptions> &&copy_options,
bool only_preview) TD_WARN_UNUSED_RESULT;
Result<vector<MessageId>> resend_messages(DialogId dialog_id, vector<MessageId> message_ids) TD_WARN_UNUSED_RESULT; Result<vector<MessageId>> resend_messages(DialogId dialog_id, vector<MessageId> message_ids) TD_WARN_UNUSED_RESULT;
@ -1581,16 +1578,18 @@ class MessagesManager final : public Actor {
bool from_background = false; bool from_background = false;
bool update_stickersets_order = false; bool update_stickersets_order = false;
bool protect_content = false; bool protect_content = false;
bool only_preview = false;
int32 schedule_date = 0; int32 schedule_date = 0;
int32 sending_id = 0; int32 sending_id = 0;
MessageSendOptions() = default; MessageSendOptions() = default;
MessageSendOptions(bool disable_notification, bool from_background, bool update_stickersets_order, MessageSendOptions(bool disable_notification, bool from_background, bool update_stickersets_order,
bool protect_content, int32 schedule_date, int32 sending_id) bool protect_content, bool only_preview, int32 schedule_date, int32 sending_id)
: disable_notification(disable_notification) : disable_notification(disable_notification)
, from_background(from_background) , from_background(from_background)
, update_stickersets_order(update_stickersets_order) , update_stickersets_order(update_stickersets_order)
, protect_content(protect_content) , protect_content(protect_content)
, only_preview(only_preview)
, schedule_date(schedule_date) , schedule_date(schedule_date)
, sending_id(sending_id) { , sending_id(sending_id) {
} }

View File

@ -5582,7 +5582,7 @@ void Td::on_request(uint64 id, td_api::sendMessage &request) {
void Td::on_request(uint64 id, td_api::sendMessageAlbum &request) { void Td::on_request(uint64 id, td_api::sendMessageAlbum &request) {
auto r_messages = messages_manager_->send_message_group( auto r_messages = messages_manager_->send_message_group(
DialogId(request.chat_id_), MessageId(request.message_thread_id_), std::move(request.reply_to_), DialogId(request.chat_id_), MessageId(request.message_thread_id_), std::move(request.reply_to_),
std::move(request.options_), std::move(request.input_message_contents_), request.only_preview_); std::move(request.options_), std::move(request.input_message_contents_));
if (r_messages.is_error()) { if (r_messages.is_error()) {
send_closure(actor_id(this), &Td::send_error, id, r_messages.move_as_error()); send_closure(actor_id(this), &Td::send_error, id, r_messages.move_as_error());
} else { } else {
@ -5905,8 +5905,7 @@ void Td::on_request(uint64 id, td_api::forwardMessages &request) {
MessageId) { return MessageCopyOptions(send_copy, remove_caption); }); MessageId) { return MessageCopyOptions(send_copy, remove_caption); });
auto r_messages = messages_manager_->forward_messages( auto r_messages = messages_manager_->forward_messages(
DialogId(request.chat_id_), MessageId(request.message_thread_id_), DialogId(request.from_chat_id_), DialogId(request.chat_id_), MessageId(request.message_thread_id_), DialogId(request.from_chat_id_),
std::move(input_message_ids), std::move(request.options_), false, std::move(message_copy_options), std::move(input_message_ids), std::move(request.options_), false, std::move(message_copy_options));
request.only_preview_);
if (r_messages.is_error()) { if (r_messages.is_error()) {
send_closure(actor_id(this), &Td::send_error, id, r_messages.move_as_error()); send_closure(actor_id(this), &Td::send_error, id, r_messages.move_as_error());
} else { } else {

View File

@ -2284,7 +2284,7 @@ class CliClient final : public Actor {
chat_id, message_thread_id_, reply_to, chat_id, message_thread_id_, reply_to,
td_api::make_object<td_api::messageSendOptions>(disable_notification, from_background, true, true, td_api::make_object<td_api::messageSendOptions>(disable_notification, from_background, true, true,
as_message_scheduling_state(schedule_date_), as_message_scheduling_state(schedule_date_),
Random::fast(1, 1000)), Random::fast(1, 1000), only_preview_),
nullptr, std::move(input_message_content))); nullptr, std::move(input_message_content)));
if (id != 0) { if (id != 0) {
query_id_to_send_message_info_[id].start_time = Time::now(); query_id_to_send_message_info_[id].start_time = Time::now();
@ -2293,7 +2293,7 @@ class CliClient final : public Actor {
td_api::object_ptr<td_api::messageSendOptions> default_message_send_options() const { td_api::object_ptr<td_api::messageSendOptions> default_message_send_options() const {
return td_api::make_object<td_api::messageSendOptions>( return td_api::make_object<td_api::messageSendOptions>(
false, false, false, true, as_message_scheduling_state(schedule_date_), Random::fast(1, 1000)); false, false, false, true, as_message_scheduling_state(schedule_date_), Random::fast(1, 1000), only_preview_);
} }
void send_get_background_url(td_api::object_ptr<td_api::BackgroundType> &&background_type) { void send_get_background_url(td_api::object_ptr<td_api::BackgroundType> &&background_type) {
@ -3711,7 +3711,7 @@ class CliClient final : public Actor {
string message_ids; string message_ids;
get_args(args, chat_id, message_ids); get_args(args, chat_id, message_ids);
send_request(td_api::make_object<td_api::deleteMessages>(chat_id, as_message_ids(message_ids), op == "dmr")); send_request(td_api::make_object<td_api::deleteMessages>(chat_id, as_message_ids(message_ids), op == "dmr"));
} else if (op == "fm" || op == "cm" || op == "fmp" || op == "cmp") { } else if (op == "fm" || op == "cm") {
ChatId chat_id; ChatId chat_id;
ChatId from_chat_id; ChatId from_chat_id;
string message_ids; string message_ids;
@ -3719,7 +3719,7 @@ class CliClient final : public Actor {
get_args(args, chat_id, from_chat_id, message_ids, message_thread_id); get_args(args, chat_id, from_chat_id, message_ids, message_thread_id);
send_request(td_api::make_object<td_api::forwardMessages>( send_request(td_api::make_object<td_api::forwardMessages>(
chat_id, message_thread_id, from_chat_id, as_message_ids(message_ids), default_message_send_options(), chat_id, message_thread_id, from_chat_id, as_message_ids(message_ids), default_message_send_options(),
op[0] == 'c', rand_bool(), op.back() == 'p')); op[0] == 'c', rand_bool()));
} else if (op == "resend") { } else if (op == "resend") {
ChatId chat_id; ChatId chat_id;
string message_ids; string message_ids;
@ -4472,6 +4472,8 @@ class CliClient final : public Actor {
as_search_messages_filter(filter))); as_search_messages_filter(filter)));
} else if (op == "ssd") { } else if (op == "ssd") {
schedule_date_ = std::move(args); schedule_date_ = std::move(args);
} else if (op == "sop") {
only_preview_ = as_bool(args);
} else if (op == "smti") { } else if (op == "smti") {
get_args(args, message_thread_id_); get_args(args, message_thread_id_);
} else if (op == "shs") { } else if (op == "shs") {
@ -4524,7 +4526,7 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::addLocalMessage>( send_request(td_api::make_object<td_api::addLocalMessage>(
chat_id, as_message_sender(sender_id), reply_to, false, chat_id, as_message_sender(sender_id), reply_to, false,
td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), nullptr, true))); td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), nullptr, true)));
} else if (op == "smap" || op == "smapr" || op == "smapp" || op == "smaprp") { } else if (op == "smap" || op == "smapr") {
ChatId chat_id; ChatId chat_id;
InputMessageReplyTo reply_to; InputMessageReplyTo reply_to;
get_args(args, chat_id, args); get_args(args, chat_id, args);
@ -4538,9 +4540,8 @@ class CliClient final : public Actor {
return content; return content;
}); });
send_request(td_api::make_object<td_api::sendMessageAlbum>( send_request(td_api::make_object<td_api::sendMessageAlbum>(
chat_id, message_thread_id_, reply_to, default_message_send_options(), std::move(input_message_contents), chat_id, message_thread_id_, reply_to, default_message_send_options(), std::move(input_message_contents)));
op == "smapp" || op == "smaprp")); } else if (op == "smad") {
} else if (op == "smad" || op == "smadp") {
ChatId chat_id; ChatId chat_id;
get_args(args, chat_id, args); get_args(args, chat_id, args);
auto input_message_contents = transform(full_split(args), [](const string &document) { auto input_message_contents = transform(full_split(args), [](const string &document) {
@ -4548,9 +4549,8 @@ class CliClient final : public Actor {
td_api::make_object<td_api::inputMessageDocument>(as_input_file(document), nullptr, true, as_caption("")); td_api::make_object<td_api::inputMessageDocument>(as_input_file(document), nullptr, true, as_caption(""));
return content; return content;
}); });
send_request(td_api::make_object<td_api::sendMessageAlbum>(chat_id, message_thread_id_, nullptr, send_request(td_api::make_object<td_api::sendMessageAlbum>(
default_message_send_options(), chat_id, message_thread_id_, nullptr, default_message_send_options(), std::move(input_message_contents)));
std::move(input_message_contents), op.back() == 'p'));
} else if (op == "gmft") { } else if (op == "gmft") {
auto r_message_file_head = read_file_str(args, 2 << 10); auto r_message_file_head = read_file_str(args, 2 << 10);
if (r_message_file_head.is_error()) { if (r_message_file_head.is_error()) {
@ -6274,6 +6274,7 @@ class CliClient final : public Actor {
int64 my_id_ = 0; int64 my_id_ = 0;
td_api::object_ptr<td_api::AuthorizationState> authorization_state_; td_api::object_ptr<td_api::AuthorizationState> authorization_state_;
string schedule_date_; string schedule_date_;
bool only_preview_ = false;
MessageThreadId message_thread_id_; MessageThreadId message_thread_id_;
bool has_spoiler_ = false; bool has_spoiler_ = false;
int32 message_self_destruct_time_ = 0; int32 message_self_destruct_time_ = 0;