Add createNewSupergroupChat.for_import.
This commit is contained in:
parent
1159323ecc
commit
e584eccc65
@ -4192,8 +4192,13 @@ createSecretChat secret_chat_id:int32 = Chat;
|
||||
//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat @user_ids Identifiers of users to be added to the basic group @title Title of the new basic group; 1-128 characters
|
||||
createNewBasicGroupChat user_ids:vector<int32> title:string = Chat;
|
||||
|
||||
//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat @title Title of the new chat; 1-128 characters @is_channel True, if a channel chat should be created @param_description Chat description; 0-255 characters @location Chat location if a location-based supergroup is being created
|
||||
createNewSupergroupChat title:string is_channel:Bool description:string location:chatLocation = Chat;
|
||||
//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat
|
||||
//@title Title of the new chat; 1-128 characters
|
||||
//@is_channel True, if a channel chat needs to be created
|
||||
//@param_description Chat description; 0-255 characters
|
||||
//@location Chat location if a location-based supergroup is being created
|
||||
//@for_import True, if the supergroup is created for importing messages using importMessage
|
||||
createNewSupergroupChat title:string is_channel:Bool description:string location:chatLocation for_import:Bool = Chat;
|
||||
|
||||
//@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user
|
||||
createNewSecretChat user_id:int32 = Chat;
|
||||
|
Binary file not shown.
@ -975,7 +975,7 @@ class CreateChannelQuery : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
void send(const string &title, bool is_megagroup, const string &about, const DialogLocation &location,
|
||||
int64 random_id) {
|
||||
bool for_import, int64 random_id) {
|
||||
int32 flags = 0;
|
||||
if (is_megagroup) {
|
||||
flags |= telegram_api::channels_createChannel::MEGAGROUP_MASK;
|
||||
@ -985,6 +985,9 @@ class CreateChannelQuery : public Td::ResultHandler {
|
||||
if (!location.empty()) {
|
||||
flags |= telegram_api::channels_createChannel::GEO_POINT_MASK;
|
||||
}
|
||||
if (for_import) {
|
||||
flags |= telegram_api::channels_createChannel::FOR_IMPORT_MASK;
|
||||
}
|
||||
|
||||
random_id_ = random_id;
|
||||
send_query(G()->net_query_creator().create(
|
||||
@ -18979,7 +18982,7 @@ DialogId MessagesManager::create_new_group_chat(const vector<UserId> &user_ids,
|
||||
}
|
||||
|
||||
DialogId MessagesManager::create_new_channel_chat(const string &title, bool is_megagroup, const string &description,
|
||||
const DialogLocation &location, int64 &random_id,
|
||||
const DialogLocation &location, bool for_import, int64 &random_id,
|
||||
Promise<Unit> &&promise) {
|
||||
LOG(INFO) << "Trying to create " << (is_megagroup ? "supergroup" : "broadcast") << " with title \"" << title
|
||||
<< "\", description \"" << description << "\" and " << location;
|
||||
@ -19014,7 +19017,8 @@ DialogId MessagesManager::create_new_channel_chat(const string &title, bool is_m
|
||||
created_dialogs_[random_id]; // reserve place for result
|
||||
|
||||
td_->create_handler<CreateChannelQuery>(std::move(promise))
|
||||
->send(new_title, is_megagroup, strip_empty_characters(description, MAX_DESCRIPTION_LENGTH), location, random_id);
|
||||
->send(new_title, is_megagroup, strip_empty_characters(description, MAX_DESCRIPTION_LENGTH), location, for_import,
|
||||
random_id);
|
||||
return DialogId();
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,8 @@ class MessagesManager : public Actor {
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
DialogId create_new_channel_chat(const string &title, bool is_megagroup, const string &description,
|
||||
const DialogLocation &location, int64 &random_id, Promise<Unit> &&promise);
|
||||
const DialogLocation &location, bool for_import, int64 &random_id,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void create_new_secret_chat(UserId user_id, Promise<SecretChatId> &&promise);
|
||||
|
||||
|
@ -1888,13 +1888,14 @@ class CreateNewSupergroupChatRequest : public RequestActor<> {
|
||||
bool is_megagroup_;
|
||||
string description_;
|
||||
DialogLocation location_;
|
||||
bool for_import_;
|
||||
int64 random_id_;
|
||||
|
||||
DialogId dialog_id_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) override {
|
||||
dialog_id_ = td->messages_manager_->create_new_channel_chat(title_, is_megagroup_, description_, location_,
|
||||
random_id_, std::move(promise));
|
||||
for_import_, random_id_, std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() override {
|
||||
@ -1904,12 +1905,14 @@ class CreateNewSupergroupChatRequest : public RequestActor<> {
|
||||
|
||||
public:
|
||||
CreateNewSupergroupChatRequest(ActorShared<Td> td, uint64 request_id, string title, bool is_megagroup,
|
||||
string description, td_api::object_ptr<td_api::chatLocation> &&location)
|
||||
string description, td_api::object_ptr<td_api::chatLocation> &&location,
|
||||
bool for_import)
|
||||
: RequestActor(std::move(td), request_id)
|
||||
, title_(std::move(title))
|
||||
, is_megagroup_(is_megagroup)
|
||||
, description_(std::move(description))
|
||||
, location_(std::move(location))
|
||||
, for_import_(for_import)
|
||||
, random_id_(0) {
|
||||
}
|
||||
};
|
||||
@ -5873,7 +5876,7 @@ void Td::on_request(uint64 id, td_api::createNewSupergroupChat &request) {
|
||||
CLEAN_INPUT_STRING(request.title_);
|
||||
CLEAN_INPUT_STRING(request.description_);
|
||||
CREATE_REQUEST(CreateNewSupergroupChatRequest, std::move(request.title_), !request.is_channel_,
|
||||
std::move(request.description_), std::move(request.location_));
|
||||
std::move(request.description_), std::move(request.location_), request.for_import_);
|
||||
}
|
||||
void Td::on_request(uint64 id, td_api::createNewSecretChat &request) {
|
||||
CREATE_REQUEST(CreateNewSecretChatRequest, request.user_id_);
|
||||
|
@ -3438,13 +3438,15 @@ class CliClient final : public Actor {
|
||||
get_args(args, user_ids_string, title);
|
||||
send_request(td_api::make_object<td_api::createNewBasicGroupChat>(as_user_ids(user_ids_string), title));
|
||||
} else if (op == "cnchc") {
|
||||
send_request(td_api::make_object<td_api::createNewSupergroupChat>(args, true, "Description", nullptr));
|
||||
send_request(td_api::make_object<td_api::createNewSupergroupChat>(args, true, "Description", nullptr, false));
|
||||
} else if (op == "cnsgc") {
|
||||
send_request(td_api::make_object<td_api::createNewSupergroupChat>(args, false, "Description", nullptr));
|
||||
send_request(td_api::make_object<td_api::createNewSupergroupChat>(args, false, "Description", nullptr, false));
|
||||
} else if (op == "cnsgcloc") {
|
||||
send_request(td_api::make_object<td_api::createNewSupergroupChat>(
|
||||
args, false, "Description",
|
||||
td_api::make_object<td_api::chatLocation>(as_location("40.0", "60.0"), "address")));
|
||||
args, false, "Description", td_api::make_object<td_api::chatLocation>(as_location("40.0", "60.0"), "address"),
|
||||
false));
|
||||
} else if (op == "cnsgcimport") {
|
||||
send_request(td_api::make_object<td_api::createNewSupergroupChat>(args, false, "Description", nullptr, true));
|
||||
} else if (op == "UpgradeBasicGroupChatToSupergroupChat") {
|
||||
send_request(td_api::make_object<td_api::upgradeBasicGroupChatToSupergroupChat>(as_chat_id(args)));
|
||||
} else if (op == "DeleteChat") {
|
||||
|
Loading…
Reference in New Issue
Block a user