|
|
|
@ -291,6 +291,7 @@ bool Client::init_methods() {
|
|
|
|
methods_.emplace("answerwebappquery", &Client::process_answer_web_app_query_query);
|
|
|
|
methods_.emplace("answerwebappquery", &Client::process_answer_web_app_query_query);
|
|
|
|
methods_.emplace("answerinlinequery", &Client::process_answer_inline_query_query);
|
|
|
|
methods_.emplace("answerinlinequery", &Client::process_answer_inline_query_query);
|
|
|
|
methods_.emplace("savepreparedinlinemessage", &Client::process_save_prepared_inline_message_query);
|
|
|
|
methods_.emplace("savepreparedinlinemessage", &Client::process_save_prepared_inline_message_query);
|
|
|
|
|
|
|
|
methods_.emplace("savepreparedkeyboardbutton", &Client::process_save_prepared_keyboard_button_query);
|
|
|
|
methods_.emplace("answercallbackquery", &Client::process_answer_callback_query_query);
|
|
|
|
methods_.emplace("answercallbackquery", &Client::process_answer_callback_query_query);
|
|
|
|
methods_.emplace("answershippingquery", &Client::process_answer_shipping_query_query);
|
|
|
|
methods_.emplace("answershippingquery", &Client::process_answer_shipping_query_query);
|
|
|
|
methods_.emplace("answerprecheckoutquery", &Client::process_answer_pre_checkout_query_query);
|
|
|
|
methods_.emplace("answerprecheckoutquery", &Client::process_answer_pre_checkout_query_query);
|
|
|
|
@ -5959,6 +5960,19 @@ class Client::JsonPreparedInlineMessageId final : public td::Jsonable {
|
|
|
|
const td_api::preparedInlineMessageId *message_;
|
|
|
|
const td_api::preparedInlineMessageId *message_;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Client::JsonPreparedKeyboardButton final : public td::Jsonable {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
explicit JsonPreparedKeyboardButton(const td_api::text *button) : button_(button) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void store(td::JsonValueScope *scope) const {
|
|
|
|
|
|
|
|
auto object = scope->enter_object();
|
|
|
|
|
|
|
|
object("id", button_->text_);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
const td_api::text *button_;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Client::TdOnOkCallback final : public TdQueryCallback {
|
|
|
|
class Client::TdOnOkCallback final : public TdQueryCallback {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
void on_result(object_ptr<td_api::Object> result) final {
|
|
|
|
void on_result(object_ptr<td_api::Object> result) final {
|
|
|
|
@ -7595,6 +7609,25 @@ class Client::TdOnSavePreparedInlineMessageCallback final : public TdQueryCallba
|
|
|
|
PromisedQueryPtr query_;
|
|
|
|
PromisedQueryPtr query_;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Client::TdOnSavePreparedKeyboardButtonCallback final : public TdQueryCallback {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
explicit TdOnSavePreparedKeyboardButtonCallback(PromisedQueryPtr query) : query_(std::move(query)) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_result(object_ptr<td_api::Object> result) final {
|
|
|
|
|
|
|
|
if (result->get_id() == td_api::error::ID) {
|
|
|
|
|
|
|
|
return fail_query_with_error(std::move(query_), move_object_as<td_api::error>(result));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CHECK(result->get_id() == td_api::text::ID);
|
|
|
|
|
|
|
|
auto text = move_object_as<td_api::text>(result);
|
|
|
|
|
|
|
|
answer_query(JsonPreparedKeyboardButton(text.get()), std::move(query_));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
PromisedQueryPtr query_;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Client::TdOnGetUserChatBoostsCallback final : public TdQueryCallback {
|
|
|
|
class Client::TdOnGetUserChatBoostsCallback final : public TdQueryCallback {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
TdOnGetUserChatBoostsCallback(Client *client, PromisedQueryPtr query) : client_(client), query_(std::move(query)) {
|
|
|
|
TdOnGetUserChatBoostsCallback(Client *client, PromisedQueryPtr query) : client_(client), query_(std::move(query)) {
|
|
|
|
@ -14000,6 +14033,23 @@ td::Status Client::process_save_prepared_inline_message_query(PromisedQueryPtr &
|
|
|
|
return td::Status::OK();
|
|
|
|
return td::Status::OK();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
td::Status Client::process_save_prepared_keyboard_button_query(PromisedQueryPtr &query) {
|
|
|
|
|
|
|
|
TRY_RESULT(user_id, get_user_id(query.get()));
|
|
|
|
|
|
|
|
auto r_value = json_decode(query->arg("button"));
|
|
|
|
|
|
|
|
if (r_value.is_error()) {
|
|
|
|
|
|
|
|
return td::Status::Error(400, "Can't parse keyboard button JSON object");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
auto value = r_value.move_as_ok();
|
|
|
|
|
|
|
|
auto r_button = get_keyboard_button(value);
|
|
|
|
|
|
|
|
if (r_button.is_error()) {
|
|
|
|
|
|
|
|
return td::Status::Error(400, PSLICE() << "Can't parse keyboard button: " << r_button.error().message());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
send_request(make_object<td_api::savePreparedKeyboardButton>(user_id, r_button.move_as_ok()),
|
|
|
|
|
|
|
|
td::make_unique<TdOnSavePreparedKeyboardButtonCallback>(std::move(query)));
|
|
|
|
|
|
|
|
return td::Status::OK();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
td::Status Client::process_answer_callback_query_query(PromisedQueryPtr &query) {
|
|
|
|
td::Status Client::process_answer_callback_query_query(PromisedQueryPtr &query) {
|
|
|
|
auto callback_query_id = td::to_integer<int64>(query->arg("callback_query_id"));
|
|
|
|
auto callback_query_id = td::to_integer<int64>(query->arg("callback_query_id"));
|
|
|
|
td::string text = query->arg("text").str();
|
|
|
|
td::string text = query->arg("text").str();
|
|
|
|
|