Add td_api::updateBusinessMessageEdited.

This commit is contained in:
levlam 2024-03-09 02:17:00 +03:00
parent b9891e0871
commit bcceb9f623
4 changed files with 24 additions and 1 deletions

View File

@ -6935,9 +6935,12 @@ updateAutosaveSettings scope:AutosaveSettingsScope settings:scopeAutosaveSetting
//@description A business connection has changed; for bots only @connection New data about the connection
updateBusinessConnection connection:businessConnection = Update;
//@description A new message was added to a business account; for bots only @connection_id Unique identifier of the connection @message The new message
//@description A new message was added to a business account; for bots only @connection_id Unique identifier of the business connection @message The new message
updateNewBusinessMessage connection_id:string message:message = Update;
//@description A message in a business account was edited; for bots only @connection_id Unique identifier of the business connection @message The edited message
updateBusinessMessageEdited connection_id:string message:message = Update;
//@description A new incoming inline query; for bots only
//@id Unique query identifier
//@sender_user_id Identifier of the user who sent the query

View File

@ -153,6 +153,21 @@ void BusinessConnectionManager::on_update_bot_new_business_message(
td_api::make_object<td_api::updateNewBusinessMessage>(connection_id.get(), std::move(message_object)));
}
void BusinessConnectionManager::on_update_bot_edit_business_message(
const BusinessConnectionId &connection_id, telegram_api::object_ptr<telegram_api::Message> &&message) {
if (!td_->auth_manager_->is_bot() || !connection_id.is_valid()) {
LOG(ERROR) << "Receive " << to_string(message);
return;
}
auto message_object = td_->messages_manager_->get_business_message_object(std::move(message));
if (message_object == nullptr) {
return;
}
send_closure(
G()->td(), &Td::send_update,
td_api::make_object<td_api::updateBusinessMessageEdited>(connection_id.get(), std::move(message_object)));
}
void BusinessConnectionManager::get_business_connection(
const BusinessConnectionId &connection_id, Promise<td_api::object_ptr<td_api::businessConnection>> &&promise) {
auto connection = business_connections_.get_pointer(connection_id);

View File

@ -41,6 +41,9 @@ class BusinessConnectionManager final : public Actor {
void on_update_bot_new_business_message(const BusinessConnectionId &connection_id,
telegram_api::object_ptr<telegram_api::Message> &&message);
void on_update_bot_edit_business_message(const BusinessConnectionId &connection_id,
telegram_api::object_ptr<telegram_api::Message> &&message);
void get_business_connection(const BusinessConnectionId &connection_id,
Promise<td_api::object_ptr<td_api::businessConnection>> &&promise);

View File

@ -3101,6 +3101,8 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
}
case telegram_api::updateBotEditBusinessMessage::ID: {
auto update = move_tl_object_as<telegram_api::updateBotEditBusinessMessage>(update_ptr);
td_->business_connection_manager_->on_update_bot_edit_business_message(
BusinessConnectionId(std::move(update->connection_id_)), std::move(update->message_));
break;
}
case telegram_api::updateBotDeleteBusinessMessage::ID: {