From 5d587345687e5e36ae8c3ef4b8a7fd6c1ece34e8 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 6 Feb 2022 01:42:43 +0300 Subject: [PATCH] tg_cli: simplify sending of photos with caption. --- td/telegram/cli.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index eefa9df2b..32e40530f 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -3733,20 +3733,15 @@ class CliClient final : public Actor { } send_message(chat_id, td_api::make_object(question, std::move(options), op != "spollp", std::move(poll_type), 0, 0, false)); - } else if (op == "sp" || op == "spcaption" || op == "spttl") { + } else if (op == "sp" || op == "spttl") { ChatId chat_id; - string photo_path; - string sticker_file_ids_str; - vector sticker_file_ids; - get_args(args, chat_id, sticker_file_ids_str, photo_path); - if (trim(photo_path).empty()) { - photo_path = sticker_file_ids_str; - } else { - sticker_file_ids = to_integers(sticker_file_ids_str); - } + string photo; + string caption; + string sticker_file_ids; + get_args(args, chat_id, photo, caption, sticker_file_ids); send_message(chat_id, td_api::make_object( - as_input_file(photo_path), nullptr, std::move(sticker_file_ids), 0, 0, - as_caption(op == "spcaption" ? "cap \n\n\n\n tion " : ""), op == "spttl" ? 10 : 0)); + as_input_file(photo), nullptr, to_integers(sticker_file_ids), 0, 0, + as_caption(caption), op == "spttl" ? 10 : 0)); } else if (op == "spg" || op == "spgttl") { ChatId chat_id; string photo_path;