Add updateNewBusinessCallbackQuery.
This commit is contained in:
parent
8827ffbbd6
commit
69bf605c7a
@ -7496,6 +7496,15 @@ updateNewCallbackQuery id:int64 sender_user_id:int53 chat_id:int53 message_id:in
|
||||
//@payload Query payload
|
||||
updateNewInlineCallbackQuery id:int64 sender_user_id:int53 inline_message_id:string chat_instance:int64 payload:CallbackQueryPayload = Update;
|
||||
|
||||
//@description A new incoming callback query from a business message; for bots only
|
||||
//@id Unique query identifier
|
||||
//@sender_user_id Identifier of the user who sent the query
|
||||
//@connection_id Unique identifier of the business connection
|
||||
//@message The message from the business account from which the query originated
|
||||
//@chat_instance An identifier uniquely corresponding to the chat a message was sent to
|
||||
//@payload Query payload
|
||||
updateNewBusinessCallbackQuery id:int64 sender_user_id:int53 connection_id:string message:businessMessage chat_instance:int64 payload:CallbackQueryPayload = Update;
|
||||
|
||||
//@description A new incoming shipping query; for bots only. Only for invoices with flexible price
|
||||
//@id Unique query identifier
|
||||
//@sender_user_id Identifier of the user who sent the query
|
||||
|
@ -154,10 +154,10 @@ tl_object_ptr<td_api::CallbackQueryPayload> CallbackQueriesManager::get_query_pa
|
||||
}
|
||||
|
||||
if (has_data) {
|
||||
return make_tl_object<td_api::callbackQueryPayloadData>(data.as_slice().str());
|
||||
return td_api::make_object<td_api::callbackQueryPayloadData>(data.as_slice().str());
|
||||
}
|
||||
if (has_game) {
|
||||
return make_tl_object<td_api::callbackQueryPayloadGame>(game_short_name);
|
||||
return td_api::make_object<td_api::callbackQueryPayloadGame>(game_short_name);
|
||||
}
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
@ -208,7 +208,7 @@ void CallbackQueriesManager::on_new_inline_query(
|
||||
}
|
||||
LOG_IF(ERROR, !td_->user_manager_->have_user(sender_user_id)) << "Receive unknown " << sender_user_id;
|
||||
if (!td_->auth_manager_->is_bot()) {
|
||||
LOG(ERROR) << "Receive new callback query";
|
||||
LOG(ERROR) << "Receive new inline callback query";
|
||||
return;
|
||||
}
|
||||
CHECK(inline_message_id != nullptr);
|
||||
@ -219,12 +219,40 @@ void CallbackQueriesManager::on_new_inline_query(
|
||||
}
|
||||
send_closure(
|
||||
G()->td(), &Td::send_update,
|
||||
make_tl_object<td_api::updateNewInlineCallbackQuery>(
|
||||
td_api::make_object<td_api::updateNewInlineCallbackQuery>(
|
||||
callback_query_id, td_->user_manager_->get_user_id_object(sender_user_id, "updateNewInlineCallbackQuery"),
|
||||
InlineQueriesManager::get_inline_message_id(std::move(inline_message_id)), chat_instance,
|
||||
std::move(payload)));
|
||||
}
|
||||
|
||||
void CallbackQueriesManager::on_new_business_query(int64 callback_query_id, UserId sender_user_id,
|
||||
string &&connection_id,
|
||||
telegram_api::object_ptr<telegram_api::Message> &&message,
|
||||
telegram_api::object_ptr<telegram_api::Message> &&reply_to_message,
|
||||
BufferSlice &&data, int64 chat_instance) {
|
||||
if (!sender_user_id.is_valid()) {
|
||||
LOG(ERROR) << "Receive new callback query from invalid " << sender_user_id;
|
||||
return;
|
||||
}
|
||||
LOG_IF(ERROR, !td_->user_manager_->have_user(sender_user_id)) << "Receive unknown " << sender_user_id;
|
||||
if (!td_->auth_manager_->is_bot()) {
|
||||
LOG(ERROR) << "Receive new business callback query";
|
||||
return;
|
||||
}
|
||||
auto message_object =
|
||||
td_->messages_manager_->get_business_message_object(std::move(message), std::move(reply_to_message));
|
||||
if (message_object == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto payload = td_api::make_object<td_api::callbackQueryPayloadData>(data.as_slice().str());
|
||||
send_closure(
|
||||
G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateNewBusinessCallbackQuery>(
|
||||
callback_query_id, td_->user_manager_->get_user_id_object(sender_user_id, "updateNewInlineCallbackQuery"),
|
||||
connection_id, std::move(message_object), chat_instance, std::move(payload)));
|
||||
}
|
||||
|
||||
void CallbackQueriesManager::send_callback_query(MessageFullId message_full_id,
|
||||
tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise) {
|
||||
|
@ -35,6 +35,11 @@ class CallbackQueriesManager {
|
||||
tl_object_ptr<telegram_api::InputBotInlineMessageID> &&inline_message_id, BufferSlice &&data,
|
||||
int64 chat_instance, string &&game_short_name);
|
||||
|
||||
void on_new_business_query(int64 callback_query_id, UserId sender_user_id, string &&connection_id,
|
||||
telegram_api::object_ptr<telegram_api::Message> &&message,
|
||||
telegram_api::object_ptr<telegram_api::Message> &&reply_to_message, BufferSlice &&data,
|
||||
int64 chat_instance);
|
||||
|
||||
void send_callback_query(MessageFullId message_full_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
|
||||
|
||||
|
@ -4148,6 +4148,14 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateInlineBotCallba
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBusinessBotCallbackQuery> update,
|
||||
Promise<Unit> &&promise) {
|
||||
td_->callback_queries_manager_->on_new_business_query(
|
||||
update->query_id_, UserId(update->user_id_), std::move(update->connection_id_), std::move(update->message_),
|
||||
std::move(update->reply_to_message_), std::move(update->data_), update->chat_instance_);
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateFavedStickers> update, Promise<Unit> &&promise) {
|
||||
td_->stickers_manager_->reload_favorite_stickers(true);
|
||||
promise.set_value(Unit());
|
||||
@ -4575,11 +4583,6 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateNewStoryReactio
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBusinessBotCallbackQuery> update,
|
||||
Promise<Unit> &&promise) {
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStarsRevenueStatus> update, Promise<Unit> &&promise) {
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
@ -565,6 +565,7 @@ class UpdatesManager final : public Actor {
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateBotCallbackQuery> update, Promise<Unit> &&promise);
|
||||
void on_update(tl_object_ptr<telegram_api::updateInlineBotCallbackQuery> update, Promise<Unit> &&promise);
|
||||
void on_update(tl_object_ptr<telegram_api::updateBusinessBotCallbackQuery> update, Promise<Unit> &&promise);
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateFavedStickers> update, Promise<Unit> &&promise);
|
||||
|
||||
@ -677,8 +678,6 @@ class UpdatesManager final : public Actor {
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateNewStoryReaction> update, Promise<Unit> &&promise);
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateBusinessBotCallbackQuery> update, Promise<Unit> &&promise);
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateStarsRevenueStatus> update, Promise<Unit> &&promise);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user