Add td_api::openChatSimilarChat.
This commit is contained in:
parent
4a45265926
commit
571fbd68aa
@ -7034,6 +7034,11 @@ getChatSimilarChats chat_id:int53 = Chats;
|
|||||||
//@return_local Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally
|
//@return_local Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally
|
||||||
getChatSimilarChatCount chat_id:int53 return_local:Bool = Count;
|
getChatSimilarChatCount chat_id:int53 return_local:Bool = Count;
|
||||||
|
|
||||||
|
//@description Informs TDLib that a chat was opened from the list of similar chats. The method is independent from openChat and closeChat methods
|
||||||
|
//@chat_id Identifier of the original chat, which similar chats were requested
|
||||||
|
//@opened_chat_id Identifier of the opened chat
|
||||||
|
openChatSimilarChat chat_id:int53 opened_chat_id:int53 = Ok;
|
||||||
|
|
||||||
//@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30
|
//@description Returns a list of frequently used chats @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30
|
||||||
getTopChats category:TopChatCategory limit:int32 = Chats;
|
getTopChats category:TopChatCategory limit:int32 = Chats;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "td/telegram/ContactsManager.h"
|
#include "td/telegram/ContactsManager.h"
|
||||||
|
|
||||||
#include "td/telegram/AnimationsManager.h"
|
#include "td/telegram/AnimationsManager.h"
|
||||||
|
#include "td/telegram/Application.h"
|
||||||
#include "td/telegram/AuthManager.h"
|
#include "td/telegram/AuthManager.h"
|
||||||
#include "td/telegram/BlockListId.h"
|
#include "td/telegram/BlockListId.h"
|
||||||
#include "td/telegram/BotMenuButton.h"
|
#include "td/telegram/BotMenuButton.h"
|
||||||
@ -10155,6 +10156,24 @@ void ContactsManager::on_get_channel_recommendations(
|
|||||||
finish_load_channel_recommendations_queries(channel_id, total_count, std::move(dialog_ids));
|
finish_load_channel_recommendations_queries(channel_id, total_count, std::move(dialog_ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::open_channel_recommended_channel(DialogId dialog_id, DialogId opened_dialog_id,
|
||||||
|
Promise<Unit> &&promise) {
|
||||||
|
if (!td_->messages_manager_->have_dialog_force(dialog_id, "open_channel_recommended_channel") ||
|
||||||
|
!td_->messages_manager_->have_dialog_force(opened_dialog_id, "open_channel_recommended_channel")) {
|
||||||
|
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||||
|
}
|
||||||
|
if (dialog_id.get_type() != DialogType::Channel || opened_dialog_id.get_type() != DialogType::Channel) {
|
||||||
|
return promise.set_error(Status::Error(400, "Invalid chat specified"));
|
||||||
|
}
|
||||||
|
vector<telegram_api::object_ptr<telegram_api::jsonObjectValue>> data;
|
||||||
|
data.push_back(telegram_api::make_object<telegram_api::jsonObjectValue>(
|
||||||
|
"ref_channel_id", make_tl_object<telegram_api::jsonString>(to_string(dialog_id.get_channel_id().get()))));
|
||||||
|
data.push_back(telegram_api::make_object<telegram_api::jsonObjectValue>(
|
||||||
|
"open_channel_id", make_tl_object<telegram_api::jsonString>(to_string(opened_dialog_id.get_channel_id().get()))));
|
||||||
|
save_app_log(td_, "channels.open_recommended_channel", DialogId(),
|
||||||
|
telegram_api::make_object<telegram_api::jsonObject>(std::move(data)), std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::return_created_public_dialogs(Promise<td_api::object_ptr<td_api::chats>> &&promise,
|
void ContactsManager::return_created_public_dialogs(Promise<td_api::object_ptr<td_api::chats>> &&promise,
|
||||||
const vector<ChannelId> &channel_ids) {
|
const vector<ChannelId> &channel_ids) {
|
||||||
if (!promise) {
|
if (!promise) {
|
||||||
|
@ -594,6 +594,8 @@ class ContactsManager final : public Actor {
|
|||||||
void get_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise,
|
void get_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise,
|
||||||
bool from_binlog);
|
bool from_binlog);
|
||||||
|
|
||||||
|
void open_channel_recommended_channel(DialogId dialog_id, DialogId opened_dialog_id, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void check_created_public_dialogs_limit(PublicDialogType type, Promise<Unit> &&promise);
|
void check_created_public_dialogs_limit(PublicDialogType type, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void reload_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise);
|
void reload_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise);
|
||||||
|
@ -5109,6 +5109,13 @@ void Td::on_request(uint64 id, const td_api::getChatSimilarChatCount &request) {
|
|||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, const td_api::openChatSimilarChat &request) {
|
||||||
|
CHECK_IS_USER();
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
contacts_manager_->open_channel_recommended_channel(DialogId(request.chat_id_), DialogId(request.opened_chat_id_),
|
||||||
|
std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::getTopChats &request) {
|
void Td::on_request(uint64 id, const td_api::getTopChats &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_REQUEST_PROMISE();
|
CREATE_REQUEST_PROMISE();
|
||||||
|
@ -641,6 +641,8 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, const td_api::getChatSimilarChatCount &request);
|
void on_request(uint64 id, const td_api::getChatSimilarChatCount &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, const td_api::openChatSimilarChat &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::getTopChats &request);
|
void on_request(uint64 id, const td_api::getTopChats &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::removeTopChat &request);
|
void on_request(uint64 id, const td_api::removeTopChat &request);
|
||||||
|
@ -5225,6 +5225,11 @@ class CliClient final : public Actor {
|
|||||||
bool return_local;
|
bool return_local;
|
||||||
get_args(args, chat_id, return_local);
|
get_args(args, chat_id, return_local);
|
||||||
send_request(td_api::make_object<td_api::getChatSimilarChatCount>(chat_id, return_local));
|
send_request(td_api::make_object<td_api::getChatSimilarChatCount>(chat_id, return_local));
|
||||||
|
} else if (op == "ocsc") {
|
||||||
|
ChatId chat_id;
|
||||||
|
ChatId similar_chat_id;
|
||||||
|
get_args(args, chat_id, similar_chat_id);
|
||||||
|
send_request(td_api::make_object<td_api::openChatSimilarChat>(chat_id, similar_chat_id));
|
||||||
} else if (op == "gcpc") {
|
} else if (op == "gcpc") {
|
||||||
send_request(td_api::make_object<td_api::getCreatedPublicChats>());
|
send_request(td_api::make_object<td_api::getCreatedPublicChats>());
|
||||||
} else if (op == "gcpcl") {
|
} else if (op == "gcpcl") {
|
||||||
|
Loading…
Reference in New Issue
Block a user