feat: get message

This commit is contained in:
omg-xtao 2023-09-26 14:13:50 +00:00 committed by GitHub
parent 53e15345b0
commit 6c418e4fa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -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();

View File

@ -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);