Add td_api::updateBusinessMessagesDeleted.
This commit is contained in:
parent
171e254634
commit
985cbf1a31
@ -6942,6 +6942,12 @@ 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
|
//@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;
|
updateBusinessMessageEdited connection_id:string message:message = Update;
|
||||||
|
|
||||||
|
//@description Messages in a business account were deleted; for bots only
|
||||||
|
//@connection_id Unique identifier of the business connection
|
||||||
|
//@chat_id Identifier of a chat in the business account in which messages were deleted
|
||||||
|
//@message_ids Unique message identifiers of the deleted messages
|
||||||
|
updateBusinessMessagesDeleted connection_id:string chat_id:int53 message_ids:vector<int53> = Update;
|
||||||
|
|
||||||
//@description A new incoming inline query; for bots only
|
//@description A new incoming inline query; for bots only
|
||||||
//@id Unique query identifier
|
//@id Unique query identifier
|
||||||
//@sender_user_id Identifier of the user who sent the query
|
//@sender_user_id Identifier of the user who sent the query
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "td/telegram/AuthManager.h"
|
#include "td/telegram/AuthManager.h"
|
||||||
#include "td/telegram/ContactsManager.h"
|
#include "td/telegram/ContactsManager.h"
|
||||||
|
#include "td/telegram/DialogManager.h"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/MessagesManager.h"
|
#include "td/telegram/MessagesManager.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
@ -15,6 +16,7 @@
|
|||||||
#include "td/telegram/telegram_api.h"
|
#include "td/telegram/telegram_api.h"
|
||||||
#include "td/telegram/UserId.h"
|
#include "td/telegram/UserId.h"
|
||||||
|
|
||||||
|
#include "td/utils/format.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
@ -168,6 +170,24 @@ void BusinessConnectionManager::on_update_bot_edit_business_message(
|
|||||||
td_api::make_object<td_api::updateBusinessMessageEdited>(connection_id.get(), std::move(message_object)));
|
td_api::make_object<td_api::updateBusinessMessageEdited>(connection_id.get(), std::move(message_object)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BusinessConnectionManager::on_update_bot_delete_business_messages(const BusinessConnectionId &connection_id,
|
||||||
|
DialogId dialog_id, vector<int32> &&messages) {
|
||||||
|
if (!td_->auth_manager_->is_bot() || !connection_id.is_valid() || dialog_id.get_type() != DialogType::User) {
|
||||||
|
LOG(ERROR) << "Receive deletion of messages " << messages << " in " << dialog_id;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vector<int64> message_ids;
|
||||||
|
for (auto message : messages) {
|
||||||
|
message_ids.push_back(MessageId(ServerMessageId(message)).get());
|
||||||
|
}
|
||||||
|
td_->dialog_manager_->force_create_dialog(dialog_id, "on_update_bot_delete_business_messages", true);
|
||||||
|
send_closure(
|
||||||
|
G()->td(), &Td::send_update,
|
||||||
|
td_api::make_object<td_api::updateBusinessMessagesDeleted>(
|
||||||
|
connection_id.get(), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateBusinessMessageDeleted"),
|
||||||
|
std::move(message_ids)));
|
||||||
|
}
|
||||||
|
|
||||||
void BusinessConnectionManager::get_business_connection(
|
void BusinessConnectionManager::get_business_connection(
|
||||||
const BusinessConnectionId &connection_id, Promise<td_api::object_ptr<td_api::businessConnection>> &&promise) {
|
const BusinessConnectionId &connection_id, Promise<td_api::object_ptr<td_api::businessConnection>> &&promise) {
|
||||||
auto connection = business_connections_.get_pointer(connection_id);
|
auto connection = business_connections_.get_pointer(connection_id);
|
||||||
|
@ -44,6 +44,9 @@ class BusinessConnectionManager final : public Actor {
|
|||||||
void on_update_bot_edit_business_message(const BusinessConnectionId &connection_id,
|
void on_update_bot_edit_business_message(const BusinessConnectionId &connection_id,
|
||||||
telegram_api::object_ptr<telegram_api::Message> &&message);
|
telegram_api::object_ptr<telegram_api::Message> &&message);
|
||||||
|
|
||||||
|
void on_update_bot_delete_business_messages(const BusinessConnectionId &connection_id, DialogId dialog_id,
|
||||||
|
vector<int32> &&messages);
|
||||||
|
|
||||||
void get_business_connection(const BusinessConnectionId &connection_id,
|
void get_business_connection(const BusinessConnectionId &connection_id,
|
||||||
Promise<td_api::object_ptr<td_api::businessConnection>> &&promise);
|
Promise<td_api::object_ptr<td_api::businessConnection>> &&promise);
|
||||||
|
|
||||||
|
@ -3107,6 +3107,9 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
|
|||||||
}
|
}
|
||||||
case telegram_api::updateBotDeleteBusinessMessage::ID: {
|
case telegram_api::updateBotDeleteBusinessMessage::ID: {
|
||||||
auto update = move_tl_object_as<telegram_api::updateBotDeleteBusinessMessage>(update_ptr);
|
auto update = move_tl_object_as<telegram_api::updateBotDeleteBusinessMessage>(update_ptr);
|
||||||
|
td_->business_connection_manager_->on_update_bot_delete_business_messages(
|
||||||
|
BusinessConnectionId(std::move(update->connection_id_)), DialogId(update->peer_),
|
||||||
|
std::move(update->messages_));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user