diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 3bb0d3b..4bb4f01 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -250,6 +250,7 @@ bool Client::init_methods() { methods_.emplace("editmessagereplymarkup", &Client::process_edit_message_reply_markup_query); methods_.emplace("deletemessage", &Client::process_delete_message_query); methods_.emplace("deletemessages", &Client::process_delete_messages_query); + methods_.emplace("getmessage", &Client::process_get_message_query); methods_.emplace("createinvoicelink", &Client::process_create_invoice_link_query); methods_.emplace("getstartransactions", &Client::process_get_star_transactions_query); methods_.emplace("refundstarpayment", &Client::process_refund_star_payment_query); @@ -11280,6 +11281,27 @@ td::Status Client::process_delete_messages_query(PromisedQueryPtr &query) { return td::Status::OK(); } +td::Status Client::process_get_message_query(PromisedQueryPtr &query) { + auto chat_id = query->arg("chat_id"); + auto message_id = get_message_id(query.get()); + + if (chat_id.empty()) { + return td::Status::Error(400, "Chat identifier is not specified"); + } + + if (message_id == 0) { + return td::Status::Error(400, "Message identifier is not specified"); + } + + check_message(chat_id, message_id, false, AccessRights::Read, "message", std::move(query), + [this](int64 chat_id, int64 message_id, PromisedQueryPtr query) { + auto message_info = get_message(chat_id, message_id, false); + CHECK(message_info != nullptr); + answer_query(JsonMessage(message_info, true, "message", this), std::move(query)); + }); + return td::Status::OK(); +} + td::Status Client::process_create_invoice_link_query(PromisedQueryPtr &query) { TRY_RESULT(input_message_invoice, get_input_message_invoice(query.get())); auto business_connection_id = query->arg("business_connection_id").str(); diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 500995a..dd8b80a 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -683,6 +683,7 @@ class Client final : public WebhookActor::Callback { td::Status process_edit_message_reply_markup_query(PromisedQueryPtr &query); td::Status process_delete_message_query(PromisedQueryPtr &query); td::Status process_delete_messages_query(PromisedQueryPtr &query); + td::Status process_get_message_query(PromisedQueryPtr &query); td::Status process_create_invoice_link_query(PromisedQueryPtr &query); td::Status process_get_star_transactions_query(PromisedQueryPtr &query); td::Status process_refund_star_payment_query(PromisedQueryPtr &query);