diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 3c6520da8..8bec04c74 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -1312,6 +1312,29 @@ class CliClient final : public Actor { return td_api::make_object(); } + static td_api::object_ptr get_chat_report_reason(MutableSlice reason) { + reason = trim(reason); + if (reason == "spam") { + return td_api::make_object(); + } + if (reason == "violence") { + return td_api::make_object(); + } + if (reason == "porno") { + return td_api::make_object(); + } + if (reason == "ca") { + return td_api::make_object(); + } + if (reason == "copyright") { + return td_api::make_object(); + } + if (reason == "geo" || reason == "location") { + return td_api::make_object(); + } + return td_api::make_object(reason.str()); + } + static td_api::object_ptr get_network_type(MutableSlice type) { type = trim(type); to_lower_inplace(type); @@ -1757,7 +1780,6 @@ class CliClient final : public Actor { string key; string secret; string other_user_ids_str; - get_args(args, endpoint, key, secret, other_user_ids_str); send_request(td_api::make_object( td_api::make_object(endpoint, key, secret), as_user_ids(other_user_ids_str))); @@ -2055,7 +2077,6 @@ class CliClient final : public Actor { "Few", "Many", "Other"))); strings.push_back(td_api::make_object( "DELETED", td_api::make_object())); - send_request(td_api::make_object( as_language_pack_info(language_code, name, native_name), std::move(strings))); } else if (op == "eclpi") { @@ -2753,7 +2774,6 @@ class CliClient final : public Actor { vector> entities; entities.push_back( td_api::make_object(0, 1, td_api::make_object())); - draft_message = td_api::make_object( as_message_id(reply_to_message_id), 0, td_api::make_object(as_formatted_text(message, std::move(entities)), true, @@ -3062,7 +3082,6 @@ class CliClient final : public Actor { string chat_id; string voice_path; get_args(args, chat_id, voice_path); - send_message(chat_id, td_api::make_object(as_input_file(voice_path), 0, "abacaba", as_caption("voice caption"))); } else if (op == "SendContact" || op == "scontact") { @@ -3180,7 +3199,6 @@ class CliClient final : public Actor { string question; get_args(args, chat_id, question, args); auto options = full_split(args); - td_api::object_ptr poll_type; if (op == "squiz") { poll_type = td_api::make_object(narrow_cast(options.size() - 1), @@ -3201,7 +3219,6 @@ class CliClient final : public Actor { } else { sticker_file_ids = to_integers(sticker_file_ids_str); } - 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)); @@ -3219,7 +3236,6 @@ class CliClient final : public Actor { string photo_path; string thumbnail_path; get_args(args, chat_id, photo_path, thumbnail_path); - send_message(chat_id, td_api::make_object(as_input_file(photo_path), as_input_thumbnail(thumbnail_path, 90, 89), vector(), 0, 0, as_caption(""), 0)); @@ -3783,29 +3799,11 @@ class CliClient final : public Actor { send_request(td_api::make_object(as_chat_id(chat_id))); } else if (op == "rc") { string chat_id; - string reason_str; + string reason; string message_ids; - get_args(args, chat_id, reason_str, message_ids); - - td_api::object_ptr reason; - if (reason_str == "spam") { - reason = td_api::make_object(); - } else if (reason_str == "violence") { - reason = td_api::make_object(); - } else if (reason_str == "porno") { - reason = td_api::make_object(); - } else if (reason_str == "ca") { - reason = td_api::make_object(); - } else if (reason_str == "copyright") { - reason = td_api::make_object(); - } else if (reason_str == "geo" || reason_str == "location") { - reason = td_api::make_object(); - } else { - reason = td_api::make_object(reason_str); - } - - send_request( - td_api::make_object(as_chat_id(chat_id), std::move(reason), as_message_ids(message_ids))); + get_args(args, chat_id, reason, message_ids); + send_request(td_api::make_object(as_chat_id(chat_id), get_chat_report_reason(reason), + as_message_ids(message_ids))); } else if (op == "gcsu") { string chat_id; string parameters; @@ -3849,7 +3847,6 @@ class CliClient final : public Actor { string user_id; string message_ids; get_args(args, supergroup_id, user_id, message_ids); - send_request(td_api::make_object(as_supergroup_id(supergroup_id), as_user_id(user_id), as_message_ids(message_ids))); } else if (op == "gdiff") {