Move SetBotUpdatesStatusQuery to BotQueries.cpp.
This commit is contained in:
parent
c8116a59a2
commit
fc07381efe
@ -308,6 +308,7 @@ function split_file($file, $chunks, $undo) {
|
|||||||
'BackgroundType' => 'BackgroundType',
|
'BackgroundType' => 'BackgroundType',
|
||||||
'Birthdate' => 'Birthdate',
|
'Birthdate' => 'Birthdate',
|
||||||
'BotMenuButton|[a-z_]*_menu_button' => 'BotMenuButton',
|
'BotMenuButton|[a-z_]*_menu_button' => 'BotMenuButton',
|
||||||
|
'send_bot_custom_query|answer_bot_custom_query|set_bot_updates_status' => 'BotQueries',
|
||||||
'boost_manager[_(-](?![.]get[(][)])|BoostManager' => 'BoostManager',
|
'boost_manager[_(-](?![.]get[(][)])|BoostManager' => 'BoostManager',
|
||||||
'bot_info_manager[_(-](?![.]get[(][)])|BotInfoManager' => 'BotInfoManager',
|
'bot_info_manager[_(-](?![.]get[(][)])|BotInfoManager' => 'BotInfoManager',
|
||||||
'BusinessAwayMessage' => 'BusinessAwayMessage',
|
'BusinessAwayMessage' => 'BusinessAwayMessage',
|
||||||
|
@ -73,6 +73,31 @@ class AnswerCustomQueryQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SetBotUpdatesStatusQuery final : public Td::ResultHandler {
|
||||||
|
public:
|
||||||
|
void send(int32 pending_update_count, const string &error_message) {
|
||||||
|
send_query(
|
||||||
|
G()->net_query_creator().create(telegram_api::help_setBotUpdatesStatus(pending_update_count, error_message)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_result(BufferSlice packet) final {
|
||||||
|
auto result_ptr = fetch_result<telegram_api::help_setBotUpdatesStatus>(packet);
|
||||||
|
if (result_ptr.is_error()) {
|
||||||
|
return on_error(result_ptr.move_as_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool result = result_ptr.ok();
|
||||||
|
LOG_IF(WARNING, !result) << "Set bot updates status has failed";
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_error(Status status) final {
|
||||||
|
if (!G()->is_expected_error(status)) {
|
||||||
|
LOG(WARNING) << "Receive error for SetBotUpdatesStatusQuery: " << status;
|
||||||
|
}
|
||||||
|
status.ignore();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void send_bot_custom_query(Td *td, const string &method, const string ¶meters,
|
void send_bot_custom_query(Td *td, const string &method, const string ¶meters,
|
||||||
Promise<td_api::object_ptr<td_api::customRequestResult>> &&promise) {
|
Promise<td_api::object_ptr<td_api::customRequestResult>> &&promise) {
|
||||||
td->create_handler<SendCustomRequestQuery>(std::move(promise))->send(method, parameters);
|
td->create_handler<SendCustomRequestQuery>(std::move(promise))->send(method, parameters);
|
||||||
@ -82,4 +107,9 @@ void answer_bot_custom_query(Td *td, int64 custom_query_id, const string &data,
|
|||||||
td->create_handler<AnswerCustomQueryQuery>(std::move(promise))->send(custom_query_id, data);
|
td->create_handler<AnswerCustomQueryQuery>(std::move(promise))->send(custom_query_id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_bot_updates_status(Td *td, int32 pending_update_count, const string &error_message, Promise<Unit> &&promise) {
|
||||||
|
td->create_handler<SetBotUpdatesStatusQuery>()->send(pending_update_count, error_message);
|
||||||
|
promise.set_value(Unit());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -20,4 +20,6 @@ void send_bot_custom_query(Td *td, const string &method, const string ¶meter
|
|||||||
|
|
||||||
void answer_bot_custom_query(Td *td, int64 custom_query_id, const string &data, Promise<Unit> &&promise);
|
void answer_bot_custom_query(Td *td, int64 custom_query_id, const string &data, Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
void set_bot_updates_status(Td *td, int32 pending_update_count, const string &error_message, Promise<Unit> &&promise);
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -276,31 +276,6 @@ class GetRecentMeUrlsQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetBotUpdatesStatusQuery final : public Td::ResultHandler {
|
|
||||||
public:
|
|
||||||
void send(int32 pending_update_count, const string &error_message) {
|
|
||||||
send_query(
|
|
||||||
G()->net_query_creator().create(telegram_api::help_setBotUpdatesStatus(pending_update_count, error_message)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_result(BufferSlice packet) final {
|
|
||||||
auto result_ptr = fetch_result<telegram_api::help_setBotUpdatesStatus>(packet);
|
|
||||||
if (result_ptr.is_error()) {
|
|
||||||
return on_error(result_ptr.move_as_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool result = result_ptr.ok();
|
|
||||||
LOG_IF(WARNING, !result) << "Set bot updates status has failed";
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_error(Status status) final {
|
|
||||||
if (!G()->is_expected_error(status)) {
|
|
||||||
LOG(WARNING) << "Receive error for SetBotUpdatesStatusQuery: " << status;
|
|
||||||
}
|
|
||||||
status.ignore();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class TestNetworkQuery final : public Td::ResultHandler {
|
class TestNetworkQuery final : public Td::ResultHandler {
|
||||||
Promise<Unit> promise_;
|
Promise<Unit> promise_;
|
||||||
|
|
||||||
@ -7628,8 +7603,8 @@ void Requests::on_request(uint64 id, td_api::getRecentlyVisitedTMeUrls &request)
|
|||||||
void Requests::on_request(uint64 id, td_api::setBotUpdatesStatus &request) {
|
void Requests::on_request(uint64 id, td_api::setBotUpdatesStatus &request) {
|
||||||
CHECK_IS_BOT();
|
CHECK_IS_BOT();
|
||||||
CLEAN_INPUT_STRING(request.error_message_);
|
CLEAN_INPUT_STRING(request.error_message_);
|
||||||
td_->create_handler<SetBotUpdatesStatusQuery>()->send(request.pending_update_count_, request.error_message_);
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
send_closure(td_actor_, &Td::send_result, id, td_api::make_object<td_api::ok>());
|
set_bot_updates_status(td_, request.pending_update_count_, request.error_message_, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Requests::on_request(uint64 id, td_api::sendCustomRequest &request) {
|
void Requests::on_request(uint64 id, td_api::sendCustomRequest &request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user