diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index a7d288e..2c370ab 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -253,6 +253,7 @@ bool Client::init_methods() { 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); + methods_.emplace("sendgift", &Client::process_send_gift_query); methods_.emplace("setgamescore", &Client::process_set_game_score_query); methods_.emplace("getgamehighscores", &Client::process_get_game_high_scores_query); methods_.emplace("answerwebappquery", &Client::process_answer_web_app_query_query); @@ -11221,6 +11222,19 @@ td::Status Client::process_refund_star_payment_query(PromisedQueryPtr &query) { return td::Status::OK(); } +td::Status Client::process_send_gift_query(PromisedQueryPtr &query) { + auto gift_id = td::to_integer(query->arg("gift_id")); + TRY_RESULT(user_id, get_user_id(query.get())); + TRY_RESULT(text, get_formatted_text(query->arg("text").str(), query->arg("text_parse_mode").str(), + get_input_entities(query.get(), "text_entities"))); + check_user(user_id, std::move(query), + [this, gift_id, user_id, text = std::move(text)](PromisedQueryPtr query) mutable { + send_request(make_object(gift_id, user_id, std::move(text), false), + td::make_unique(std::move(query))); + }); + return td::Status::OK(); +} + td::Status Client::process_set_game_score_query(PromisedQueryPtr &query) { auto chat_id = query->arg("chat_id"); auto message_id = get_message_id(query.get()); diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 1e701f0..a137af4 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_create_invoice_link_query(PromisedQueryPtr &query); td::Status process_get_star_transactions_query(PromisedQueryPtr &query); td::Status process_refund_star_payment_query(PromisedQueryPtr &query); + td::Status process_send_gift_query(PromisedQueryPtr &query); td::Status process_set_game_score_query(PromisedQueryPtr &query); td::Status process_get_game_high_scores_query(PromisedQueryPtr &query); td::Status process_answer_web_app_query_query(PromisedQueryPtr &query);