Add td_api::deleteRevokedChatInviteLink.
This commit is contained in:
parent
d52c676912
commit
93645ca29d
@ -4389,6 +4389,9 @@ getChatInviteLinks chat_id:int53 administrator_user_id:int32 is_revoked:Bool off
|
|||||||
//@offset_member A chat member from which to return next chat members; use null to get results from the beginning @limit Maximum number of chat members to return
|
//@offset_member A chat member from which to return next chat members; use null to get results from the beginning @limit Maximum number of chat members to return
|
||||||
getChatInviteLinkMembers chat_id:int53 invite_link:string offset_member:chatInviteLinkMember limit:int32 = ChatInviteLinkMembers;
|
getChatInviteLinkMembers chat_id:int53 invite_link:string offset_member:chatInviteLinkMember limit:int32 = ChatInviteLinkMembers;
|
||||||
|
|
||||||
|
//@description Deletes revoked chat invite links. Requires administrator privileges and can_invite_users right @chat_id Chat identifier @invite_link Invite link to revoke
|
||||||
|
deleteRevokedChatInviteLink chat_id:int53 invite_link:string = Ok;
|
||||||
|
|
||||||
//@description Checks the validity of an invite link for a chat and returns information about the corresponding chat @invite_link Invite link to be checked; must begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/"
|
//@description Checks the validity of an invite link for a chat and returns information about the corresponding chat @invite_link Invite link to be checked; must begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/"
|
||||||
checkChatInviteLink invite_link:string = ChatInviteLinkInfo;
|
checkChatInviteLink invite_link:string = ChatInviteLinkInfo;
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1776,6 +1776,40 @@ class GetChatInviteImportersQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DeleteExportedChatInviteQuery : public Td::ResultHandler {
|
||||||
|
Promise<Unit> promise_;
|
||||||
|
DialogId dialog_id_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DeleteExportedChatInviteQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void send(DialogId dialog_id, const string &invite_link) {
|
||||||
|
dialog_id_ = dialog_id;
|
||||||
|
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
|
||||||
|
if (input_peer == nullptr) {
|
||||||
|
return on_error(0, Status::Error(400, "Can't access the chat"));
|
||||||
|
}
|
||||||
|
|
||||||
|
send_query(G()->net_query_creator().create(
|
||||||
|
telegram_api::messages_deleteExportedChatInvite(std::move(input_peer), invite_link)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_result(uint64 id, BufferSlice packet) override {
|
||||||
|
auto result_ptr = fetch_result<telegram_api::messages_deleteExportedChatInvite>(packet);
|
||||||
|
if (result_ptr.is_error()) {
|
||||||
|
return on_error(id, result_ptr.move_as_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
promise_.set_value(Unit());
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_error(uint64 id, Status status) override {
|
||||||
|
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "DeleteExportedChatInviteQuery");
|
||||||
|
promise_.set_error(std::move(status));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class CheckDialogInviteLinkQuery : public Td::ResultHandler {
|
class CheckDialogInviteLinkQuery : public Td::ResultHandler {
|
||||||
Promise<Unit> promise_;
|
Promise<Unit> promise_;
|
||||||
string invite_link_;
|
string invite_link_;
|
||||||
@ -7124,6 +7158,13 @@ void ContactsManager::get_dialog_invite_link_users(
|
|||||||
->send(dialog_id, invite_link, offset_date, offset_user_id, limit);
|
->send(dialog_id, invite_link, offset_date, offset_user_id, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::delete_revoked_dialog_invite_link(DialogId dialog_id, const string &invite_link,
|
||||||
|
Promise<Unit> &&promise) {
|
||||||
|
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id));
|
||||||
|
|
||||||
|
td_->create_handler<DeleteExportedChatInviteQuery>(std::move(promise))->send(dialog_id, invite_link);
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::check_dialog_invite_link(const string &invite_link, Promise<Unit> &&promise) const {
|
void ContactsManager::check_dialog_invite_link(const string &invite_link, Promise<Unit> &&promise) const {
|
||||||
if (invite_link_infos_.count(invite_link) > 0) {
|
if (invite_link_infos_.count(invite_link) > 0) {
|
||||||
return promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
|
@ -406,6 +406,8 @@ class ContactsManager : public Actor {
|
|||||||
td_api::object_ptr<td_api::chatInviteLinkMember> offset_member, int32 limit,
|
td_api::object_ptr<td_api::chatInviteLinkMember> offset_member, int32 limit,
|
||||||
Promise<td_api::object_ptr<td_api::chatInviteLinkMembers>> &&promise);
|
Promise<td_api::object_ptr<td_api::chatInviteLinkMembers>> &&promise);
|
||||||
|
|
||||||
|
void delete_revoked_dialog_invite_link(DialogId dialog_id, const string &invite_link, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void check_dialog_invite_link(const string &invite_link, Promise<Unit> &&promise) const;
|
void check_dialog_invite_link(const string &invite_link, Promise<Unit> &&promise) const;
|
||||||
|
|
||||||
void import_dialog_invite_link(const string &invite_link, Promise<DialogId> &&promise);
|
void import_dialog_invite_link(const string &invite_link, Promise<DialogId> &&promise);
|
||||||
|
@ -6304,6 +6304,13 @@ void Td::on_request(uint64 id, td_api::getChatInviteLinkMembers &request) {
|
|||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, td_api::deleteRevokedChatInviteLink &request) {
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
CLEAN_INPUT_STRING(request.invite_link_);
|
||||||
|
contacts_manager_->delete_revoked_dialog_invite_link(DialogId(request.chat_id_), request.invite_link_,
|
||||||
|
std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::checkChatInviteLink &request) {
|
void Td::on_request(uint64 id, td_api::checkChatInviteLink &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CLEAN_INPUT_STRING(request.invite_link_);
|
CLEAN_INPUT_STRING(request.invite_link_);
|
||||||
|
@ -794,6 +794,8 @@ class Td final : public NetQueryCallback {
|
|||||||
|
|
||||||
void on_request(uint64 id, td_api::getChatInviteLinkMembers &request);
|
void on_request(uint64 id, td_api::getChatInviteLinkMembers &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, td_api::deleteRevokedChatInviteLink &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::checkChatInviteLink &request);
|
void on_request(uint64 id, td_api::checkChatInviteLink &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::joinChatByInviteLink &request);
|
void on_request(uint64 id, td_api::joinChatByInviteLink &request);
|
||||||
|
@ -2719,6 +2719,11 @@ class CliClient final : public Actor {
|
|||||||
send_request(td_api::make_object<td_api::getChatInviteLinkMembers>(
|
send_request(td_api::make_object<td_api::getChatInviteLinkMembers>(
|
||||||
as_chat_id(chat_id), invite_link,
|
as_chat_id(chat_id), invite_link,
|
||||||
td_api::make_object<td_api::chatInviteLinkMember>(as_user_id(offset_user_id), offset_date), as_limit(limit)));
|
td_api::make_object<td_api::chatInviteLinkMember>(as_user_id(offset_user_id), offset_date), as_limit(limit)));
|
||||||
|
} else if (op == "drcil") {
|
||||||
|
string chat_id;
|
||||||
|
string invite_link;
|
||||||
|
get_args(args, chat_id, invite_link);
|
||||||
|
send_request(td_api::make_object<td_api::deleteRevokedChatInviteLink>(as_chat_id(chat_id), invite_link));
|
||||||
} else if (op == "ccil") {
|
} else if (op == "ccil") {
|
||||||
send_request(td_api::make_object<td_api::checkChatInviteLink>(args));
|
send_request(td_api::make_object<td_api::checkChatInviteLink>(args));
|
||||||
} else if (op == "jcbil") {
|
} else if (op == "jcbil") {
|
||||||
|
Loading…
Reference in New Issue
Block a user