2
0
mirror of https://github.com/tdlib/telegram-bot-api synced 2025-08-22 18:08:31 +00:00

Support replying to specific checklist task.

This commit is contained in:
levlam 2025-08-01 17:13:24 +03:00
parent cb63e5d084
commit cc40dd145e
2 changed files with 42 additions and 37 deletions

View File

@ -7577,15 +7577,16 @@ void Client::check_reply_parameters(td::Slice chat_id_str, InputReplyParameters
chat_id_str, AccessRights::Write, std::move(query),
[this, reply_parameters = std::move(reply_parameters), message_thread_id, on_success = std::move(on_success)](
int64 chat_id, PromisedQueryPtr query) mutable {
auto on_reply_message_resolved = [this, chat_id, message_thread_id, quote = std::move(reply_parameters.quote),
on_success = std::move(on_success)](int64 reply_in_chat_id,
int64 reply_to_message_id,
PromisedQueryPtr query) mutable {
auto on_reply_message_resolved =
[this, chat_id, message_thread_id, quote = std::move(reply_parameters.quote),
checklist_task_id = reply_parameters.checklist_task_id, on_success = std::move(on_success)](
int64 reply_in_chat_id, int64 reply_to_message_id, PromisedQueryPtr query) mutable {
CheckedReplyParameters reply_parameters;
reply_parameters.reply_to_message_id = reply_to_message_id;
if (reply_to_message_id > 0) {
reply_parameters.reply_in_chat_id = reply_in_chat_id;
reply_parameters.quote = std::move(quote);
reply_parameters.checklist_task_id = checklist_task_id;
}
if (message_thread_id <= 0) {
@ -8454,12 +8455,12 @@ td_api::object_ptr<td_api::InputMessageReplyTo> Client::get_input_message_reply_
CheckedReplyParameters &&reply_parameters) {
if (reply_parameters.reply_to_message_id > 0) {
if (reply_parameters.reply_in_chat_id != 0) {
return make_object<td_api::inputMessageReplyToExternalMessage>(reply_parameters.reply_in_chat_id,
reply_parameters.reply_to_message_id,
std::move(reply_parameters.quote), 0);
return make_object<td_api::inputMessageReplyToExternalMessage>(
reply_parameters.reply_in_chat_id, reply_parameters.reply_to_message_id, std::move(reply_parameters.quote),
reply_parameters.checklist_task_id);
}
return make_object<td_api::inputMessageReplyToMessage>(reply_parameters.reply_to_message_id,
std::move(reply_parameters.quote), 0);
return make_object<td_api::inputMessageReplyToMessage>(
reply_parameters.reply_to_message_id, std::move(reply_parameters.quote), reply_parameters.checklist_task_id);
}
return nullptr;
}
@ -8467,8 +8468,8 @@ td_api::object_ptr<td_api::InputMessageReplyTo> Client::get_input_message_reply_
td_api::object_ptr<td_api::InputMessageReplyTo> Client::get_input_message_reply_to(
InputReplyParameters &&reply_parameters) {
if (reply_parameters.reply_in_chat_id.empty() && reply_parameters.reply_to_message_id > 0) {
return make_object<td_api::inputMessageReplyToMessage>(reply_parameters.reply_to_message_id,
std::move(reply_parameters.quote), 0);
return make_object<td_api::inputMessageReplyToMessage>(
reply_parameters.reply_to_message_id, std::move(reply_parameters.quote), reply_parameters.checklist_task_id);
}
return nullptr;
}
@ -8512,12 +8513,14 @@ td::Result<Client::InputReplyParameters> Client::get_reply_parameters(td::JsonVa
TRY_RESULT(quote,
get_formatted_text(std::move(input_quote), std::move(parse_mode), object.extract_field("quote_entities")));
TRY_RESULT(quote_position, object.get_optional_int_field("quote_position"));
TRY_RESULT(checklist_task_id, object.get_optional_int_field("checklist_task_id"));
InputReplyParameters result;
result.reply_in_chat_id = std::move(chat_id);
result.reply_to_message_id = as_tdlib_message_id(td::max(message_id, 0));
result.allow_sending_without_reply = allow_sending_without_reply;
result.quote = make_object<td_api::inputTextQuote>(std::move(quote), quote_position);
result.checklist_task_id = checklist_task_id;
return std::move(result);
}

View File

@ -322,12 +322,14 @@ class Client final : public WebhookActor::Callback {
int64 reply_to_message_id = 0;
bool allow_sending_without_reply = false;
object_ptr<td_api::inputTextQuote> quote;
int32 checklist_task_id = 0;
};
struct CheckedReplyParameters {
int64 reply_in_chat_id = 0;
int64 reply_to_message_id = 0;
object_ptr<td_api::inputTextQuote> quote;
int32 checklist_task_id = 0;
};
struct UserInfo;