Add td_api::deleteChatFilterInviteLink.
This commit is contained in:
parent
a9f862c3c3
commit
49b9ea2ec1
@ -6812,6 +6812,11 @@ getChatFilterInviteLinks chat_filter_id:int32 = ChatFilterInviteLinks;
|
||||
//@chat_ids New identifiers of basic group, supergroup, or channel chats to be accessible by the invite link. The chats must be public, or the user must be able to invite new members to them by an invite link. Basic groups will be automatically converted to supergroups before link editing
|
||||
editChatFilterInviteLink chat_filter_id:int32 invite_link:string name:string chat_ids:vector<int53> = ChatFilterInviteLink;
|
||||
|
||||
//@description Deletes an invite link for a chat filter
|
||||
//@chat_filter_id Chat filter identifier
|
||||
//@invite_link Invite link to be deleted
|
||||
deleteChatFilterInviteLink chat_filter_id:int32 invite_link:string = Ok;
|
||||
|
||||
|
||||
//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right
|
||||
//@chat_id Chat identifier
|
||||
|
@ -220,6 +220,34 @@ class EditExportedChatlistInviteQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class DeleteExportedChatlistInviteQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit DeleteExportedChatlistInviteQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(DialogFilterId dialog_filter_id, const string &slug) {
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::chatlists_deleteExportedInvite(dialog_filter_id.get_input_chatlist(), slug)));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::chatlists_deleteExportedInvite>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
auto ptr = result_ptr.move_as_ok();
|
||||
LOG(INFO) << "Receive result for DeleteExportedChatlistInviteQuery: " << ptr;
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class GetDialogsQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
bool is_single_ = false;
|
||||
@ -1581,6 +1609,15 @@ void DialogFilterManager::edit_dialog_filter_invite_link(
|
||||
->send(dialog_filter_id, invite_link, invite_link_name, std::move(input_peers));
|
||||
}
|
||||
|
||||
void DialogFilterManager::delete_dialog_filter_invite_link(DialogFilterId dialog_filter_id, string invite_link,
|
||||
Promise<Unit> promise) {
|
||||
auto dialog_filter = get_dialog_filter(dialog_filter_id);
|
||||
if (dialog_filter == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Chat folder not found"));
|
||||
}
|
||||
td_->create_handler<DeleteExportedChatlistInviteQuery>(std::move(promise))->send(dialog_filter_id, invite_link);
|
||||
}
|
||||
|
||||
void DialogFilterManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||
if (have_dialog_filters()) {
|
||||
updates.push_back(get_update_chat_filters_object());
|
||||
|
@ -83,6 +83,8 @@ class DialogFilterManager final : public Actor {
|
||||
vector<DialogId> dialog_ids,
|
||||
Promise<td_api::object_ptr<td_api::chatFilterInviteLink>> promise);
|
||||
|
||||
void delete_dialog_filter_invite_link(DialogFilterId dialog_filter_id, string invite_link, Promise<Unit> promise);
|
||||
|
||||
void on_get_dialog_filter(telegram_api::object_ptr<telegram_api::DialogFilter> filter);
|
||||
|
||||
void get_recommended_dialog_filters(Promise<td_api::object_ptr<td_api::recommendedChatFilters>> &&promise);
|
||||
|
@ -6177,6 +6177,14 @@ void Td::on_request(uint64 id, td_api::editChatFilterInviteLink &request) {
|
||||
DialogId::get_dialog_ids(request.chat_ids_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::deleteChatFilterInviteLink &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.invite_link_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
dialog_filter_manager_->delete_dialog_filter_invite_link(DialogFilterId(request.chat_filter_id_),
|
||||
std::move(request.invite_link_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setChatTitle &request) {
|
||||
CLEAN_INPUT_STRING(request.title_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
|
@ -931,6 +931,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::editChatFilterInviteLink &request);
|
||||
|
||||
void on_request(uint64 id, td_api::deleteChatFilterInviteLink &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setChatTitle &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::setChatPhoto &request);
|
||||
|
@ -4605,6 +4605,11 @@ class CliClient final : public Actor {
|
||||
get_args(args, chat_filter_id, invite_link, name, chat_ids);
|
||||
send_request(td_api::make_object<td_api::editChatFilterInviteLink>(chat_filter_id, invite_link, name,
|
||||
as_chat_ids(chat_ids)));
|
||||
} else if (op == "dcfil") {
|
||||
ChatFilterId chat_filter_id;
|
||||
string invite_link;
|
||||
get_args(args, chat_filter_id, invite_link);
|
||||
send_request(td_api::make_object<td_api::deleteChatFilterInviteLink>(chat_filter_id, invite_link));
|
||||
} else if (op == "grcf") {
|
||||
send_request(td_api::make_object<td_api::getRecommendedChatFilters>());
|
||||
} else if (op == "gcfdin") {
|
||||
|
Loading…
Reference in New Issue
Block a user