tg_cli: simplify has_spoiler testing.
This commit is contained in:
parent
02db4f2fac
commit
0b8e1747a5
@ -3684,8 +3684,9 @@ class CliClient final : public Actor {
|
|||||||
message = string(4097, 'a');
|
message = string(4097, 'a');
|
||||||
}
|
}
|
||||||
if (op[3] == 'p') {
|
if (op[3] == 'p') {
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
send_message(chat_id,
|
||||||
as_local_file("rgb.jpg"), nullptr, Auto(), 0, 0, as_caption(message), 0, false));
|
td_api::make_object<td_api::inputMessagePhoto>(as_local_file("rgb.jpg"), nullptr, Auto(), 0, 0,
|
||||||
|
as_caption(message), 0, has_spoiler_));
|
||||||
} else {
|
} else {
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), false, true));
|
send_message(chat_id, td_api::make_object<td_api::inputMessageText>(as_formatted_text(message), false, true));
|
||||||
}
|
}
|
||||||
@ -3702,6 +3703,8 @@ class CliClient final : public Actor {
|
|||||||
schedule_date_ = std::move(args);
|
schedule_date_ = std::move(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") {
|
||||||
|
has_spoiler_ = as_bool(args);
|
||||||
} else if (op == "gcams") {
|
} else if (op == "gcams") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
get_args(args, chat_id);
|
get_args(args, chat_id);
|
||||||
@ -3756,9 +3759,9 @@ class CliClient final : public Actor {
|
|||||||
if (op == "smapr" || op == "smaprp") {
|
if (op == "smapr" || op == "smaprp") {
|
||||||
get_args(args, reply_to_message_id, args);
|
get_args(args, reply_to_message_id, args);
|
||||||
}
|
}
|
||||||
auto input_message_contents = transform(full_split(args), [](const string &photo) {
|
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>(
|
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(""), 0, false);
|
as_input_file(photo), nullptr, Auto(), 0, 0, as_caption(""), 0, has_spoiler_);
|
||||||
return content;
|
return content;
|
||||||
});
|
});
|
||||||
send_request(td_api::make_object<td_api::sendMessageAlbum>(
|
send_request(td_api::make_object<td_api::sendMessageAlbum>(
|
||||||
@ -3837,7 +3840,7 @@ class CliClient final : public Actor {
|
|||||||
send_request(td_api::make_object<td_api::editMessageMedia>(
|
send_request(td_api::make_object<td_api::editMessageMedia>(
|
||||||
chat_id, message_id, nullptr,
|
chat_id, message_id, nullptr,
|
||||||
td_api::make_object<td_api::inputMessagePhoto>(as_input_file(photo), as_input_thumbnail(photo), Auto(), 0, 0,
|
td_api::make_object<td_api::inputMessagePhoto>(as_input_file(photo), as_input_thumbnail(photo), Auto(), 0, 0,
|
||||||
as_caption(""), op == "empttl" ? 10 : 0, false)));
|
as_caption(""), op == "empttl" ? 10 : 0, has_spoiler_)));
|
||||||
} else if (op == "emvt") {
|
} else if (op == "emvt") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
@ -3847,7 +3850,7 @@ class CliClient final : public Actor {
|
|||||||
send_request(td_api::make_object<td_api::editMessageMedia>(
|
send_request(td_api::make_object<td_api::editMessageMedia>(
|
||||||
chat_id, message_id, nullptr,
|
chat_id, message_id, nullptr,
|
||||||
td_api::make_object<td_api::inputMessageVideo>(as_input_file(video), as_input_thumbnail(thumbnail), Auto(), 1,
|
td_api::make_object<td_api::inputMessageVideo>(as_input_file(video), as_input_thumbnail(thumbnail), Auto(), 1,
|
||||||
2, 3, true, as_caption(""), 0, false)));
|
2, 3, true, as_caption(""), 0, has_spoiler_)));
|
||||||
} else if (op == "emll") {
|
} else if (op == "emll") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
@ -4161,7 +4164,7 @@ class CliClient final : public Actor {
|
|||||||
get_args(args, chat_id, photo, caption, sticker_file_ids);
|
get_args(args, chat_id, photo, caption, sticker_file_ids);
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
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_input_file(photo), nullptr, to_integers<int32>(sticker_file_ids), 0, 0,
|
||||||
as_caption(caption), op == "spttl" ? 10 : 0, false));
|
as_caption(caption), op == "spttl" ? 10 : 0, has_spoiler_));
|
||||||
} else if (op == "spg" || op == "spgttl") {
|
} else if (op == "spg" || op == "spgttl") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string photo_path;
|
string photo_path;
|
||||||
@ -4170,7 +4173,7 @@ class CliClient final : public Actor {
|
|||||||
get_args(args, chat_id, photo_path, conversion, expected_size);
|
get_args(args, chat_id, photo_path, conversion, expected_size);
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
||||||
as_generated_file(photo_path, conversion, expected_size), nullptr, vector<int32>(), 0,
|
as_generated_file(photo_path, conversion, expected_size), nullptr, vector<int32>(), 0,
|
||||||
0, as_caption(""), op == "spgttl" ? 10 : 0, false));
|
0, as_caption(""), op == "spgttl" ? 10 : 0, has_spoiler_));
|
||||||
} else if (op == "spt") {
|
} else if (op == "spt") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string photo_path;
|
string photo_path;
|
||||||
@ -4178,7 +4181,7 @@ class CliClient final : public Actor {
|
|||||||
get_args(args, chat_id, photo_path, thumbnail_path);
|
get_args(args, chat_id, photo_path, thumbnail_path);
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
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>(),
|
as_input_file(photo_path), as_input_thumbnail(thumbnail_path, 90, 89), vector<int32>(),
|
||||||
0, 0, as_caption(""), 0, false));
|
0, 0, as_caption(""), 0, has_spoiler_));
|
||||||
} else if (op == "sptg") {
|
} else if (op == "sptg") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string photo_path;
|
string photo_path;
|
||||||
@ -4188,7 +4191,7 @@ class CliClient final : public Actor {
|
|||||||
send_message(chat_id,
|
send_message(chat_id,
|
||||||
td_api::make_object<td_api::inputMessagePhoto>(
|
td_api::make_object<td_api::inputMessagePhoto>(
|
||||||
as_input_file(photo_path), as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89),
|
as_input_file(photo_path), as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89),
|
||||||
vector<int32>(), 0, 0, as_caption(""), 0, false));
|
vector<int32>(), 0, 0, as_caption(""), 0, has_spoiler_));
|
||||||
} else if (op == "spgtg") {
|
} else if (op == "spgtg") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string photo_path;
|
string photo_path;
|
||||||
@ -4199,13 +4202,14 @@ class CliClient final : public Actor {
|
|||||||
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
||||||
as_generated_file(photo_path, conversion),
|
as_generated_file(photo_path, conversion),
|
||||||
as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89), vector<int32>(), 0, 0,
|
as_input_thumbnail(thumbnail_path, thumbnail_conversion, 90, 89), vector<int32>(), 0, 0,
|
||||||
as_caption(""), 0, false));
|
as_caption(""), 0, has_spoiler_));
|
||||||
} else if (op == "spid") {
|
} else if (op == "spid") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string file_id;
|
string file_id;
|
||||||
get_args(args, chat_id, file_id);
|
get_args(args, chat_id, file_id);
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessagePhoto>(
|
send_message(chat_id,
|
||||||
as_input_file_id(file_id), nullptr, vector<int32>(), 0, 0, as_caption(""), 0, false));
|
td_api::make_object<td_api::inputMessagePhoto>(as_input_file_id(file_id), nullptr, vector<int32>(),
|
||||||
|
0, 0, as_caption(""), 0, has_spoiler_));
|
||||||
} else if (op == "ss") {
|
} else if (op == "ss") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string sticker_path;
|
string sticker_path;
|
||||||
@ -4239,7 +4243,7 @@ class CliClient final : public Actor {
|
|||||||
}
|
}
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessageVideo>(
|
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_input_file(video_path), nullptr, std::move(sticker_file_ids), 1, 2, 3, true,
|
||||||
as_caption(""), op == "svttl" ? 10 : 0, false));
|
as_caption(""), op == "svttl" ? 10 : 0, has_spoiler_));
|
||||||
} else if (op == "svt" || op == "svtttl") {
|
} else if (op == "svt" || op == "svtttl") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string video;
|
string video;
|
||||||
@ -4247,7 +4251,7 @@ class CliClient final : public Actor {
|
|||||||
get_args(args, chat_id, video, thumbnail);
|
get_args(args, chat_id, video, thumbnail);
|
||||||
send_message(chat_id, td_api::make_object<td_api::inputMessageVideo>(
|
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_input_file(video), as_input_thumbnail(thumbnail), vector<int32>(), 0, 0, 0, true,
|
||||||
as_caption(""), op == "svtttl" ? 10 : 0, false));
|
as_caption(""), op == "svtttl" ? 10 : 0, has_spoiler_));
|
||||||
} else if (op == "svn") {
|
} else if (op == "svn") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string video_path;
|
string video_path;
|
||||||
@ -5317,6 +5321,7 @@ class CliClient final : public Actor {
|
|||||||
td_api::object_ptr<td_api::AuthorizationState> authorization_state_;
|
td_api::object_ptr<td_api::AuthorizationState> authorization_state_;
|
||||||
string schedule_date_;
|
string schedule_date_;
|
||||||
MessageThreadId message_thread_id_;
|
MessageThreadId message_thread_id_;
|
||||||
|
bool has_spoiler_ = false;
|
||||||
int64 opened_chat_id_ = 0;
|
int64 opened_chat_id_ = 0;
|
||||||
|
|
||||||
ConcurrentScheduler *scheduler_{nullptr};
|
ConcurrentScheduler *scheduler_{nullptr};
|
||||||
|
Loading…
Reference in New Issue
Block a user