Add td_api::deleteRevokedChatInviteLink.
This commit is contained in:
parent
93645ca29d
commit
3f91df5a47
@ -4365,14 +4365,14 @@ readFilePart file_id:int32 offset:int32 count:int32 = FilePart;
|
||||
deleteFile file_id:int32 = Ok;
|
||||
|
||||
|
||||
//@description Creates a new invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right
|
||||
//@description Creates a new invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat
|
||||
//@chat_id Chat identifier
|
||||
//@expire_date Point in time (Unix timestamp) when the link will expire; pass 0 if never
|
||||
//@member_limit Maximum number of chat members that can join the chat by the link simultaneously; 0-100000; pass 0 if not limited
|
||||
//@is_permanent True, if new permanent chat link needs to be created instead of the previous one
|
||||
createChatInviteLink chat_id:int53 expire_date:int32 member_limit:int32 is_permanent:Bool = ChatInviteLink;
|
||||
|
||||
//@description Edits an invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right
|
||||
//@description Edits an invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat
|
||||
//@chat_id Chat identifier
|
||||
//@invite_link Invite link to be edited; must begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/"
|
||||
//@expire_date Point in time (Unix timestamp) when the link will expire; pass 0 if never
|
||||
@ -4380,18 +4380,21 @@ createChatInviteLink chat_id:int53 expire_date:int32 member_limit:int32 is_perma
|
||||
//@is_revoked True, if the link is revoked
|
||||
editChatInviteLink chat_id:int53 invite_link:string expire_date:int32 member_limit:int32 is_revoked:Bool = ChatInviteLink;
|
||||
|
||||
//@description Returns exported invite links for a chat. Requires administrator privileges and can_invite_users right @chat_id Chat identifier @administrator_user_id If not 0, only invite links created by the specified administrator will be returned
|
||||
//@description Returns exported invite links for a chat. Requires administrator privileges and can_invite_users right in the chat @chat_id Chat identifier @administrator_user_id If not 0, only invite links created by the specified administrator will be returned
|
||||
//@is_revoked Pass true if revoked links needs to be returned instead of active or expired
|
||||
//@offset_invite_link Invite link starting after which to return invite links; use empty string to get results from the beginning @limit Maximum number of invite links to return
|
||||
getChatInviteLinks chat_id:int53 administrator_user_id:int32 is_revoked:Bool offset_invite_link:string limit:int32 = ChatInviteLinks;
|
||||
|
||||
//@description Returns chat members joined a chat by an invite link. Requires administrator privileges and can_invite_users right @chat_id Chat identifier @invite_link Invite link for which to return chat members
|
||||
//@description Returns chat members joined a chat by an invite link. Requires administrator privileges and can_invite_users right in the chat @chat_id Chat identifier @invite_link Invite link for which to return chat members
|
||||
//@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;
|
||||
|
||||
//@description Deletes revoked chat invite links. Requires administrator privileges and can_invite_users right @chat_id Chat identifier @invite_link Invite link to revoke
|
||||
//@description Deletes revoked chat invite links. Requires administrator privileges and can_invite_users right in the chat @chat_id Chat identifier @invite_link Invite link to revoke
|
||||
deleteRevokedChatInviteLink chat_id:int53 invite_link:string = Ok;
|
||||
|
||||
//@description Deletes all revoked chat invite links. Requires administrator privileges and can_invite_users right in the chat @chat_id Chat identifier
|
||||
deleteAllRevokedChatInviteLinks chat_id:int53 = 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/"
|
||||
checkChatInviteLink invite_link:string = ChatInviteLinkInfo;
|
||||
|
||||
|
Binary file not shown.
@ -1810,6 +1810,40 @@ class DeleteExportedChatInviteQuery : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class DeleteRevokedExportedChatInvitesQuery : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
DialogId dialog_id_;
|
||||
|
||||
public:
|
||||
explicit DeleteRevokedExportedChatInvitesQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id) {
|
||||
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_deleteRevokedExportedChatInvites(std::move(input_peer))));
|
||||
}
|
||||
|
||||
void on_result(uint64 id, BufferSlice packet) override {
|
||||
auto result_ptr = fetch_result<telegram_api::messages_deleteRevokedExportedChatInvites>(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, "DeleteRevokedExportedChatInvitesQuery");
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class CheckDialogInviteLinkQuery : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
string invite_link_;
|
||||
@ -7165,6 +7199,12 @@ void ContactsManager::delete_revoked_dialog_invite_link(DialogId dialog_id, cons
|
||||
td_->create_handler<DeleteExportedChatInviteQuery>(std::move(promise))->send(dialog_id, invite_link);
|
||||
}
|
||||
|
||||
void ContactsManager::delete_all_revoked_dialog_invite_links(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id));
|
||||
|
||||
td_->create_handler<DeleteRevokedExportedChatInvitesQuery>(std::move(promise))->send(dialog_id);
|
||||
}
|
||||
|
||||
void ContactsManager::check_dialog_invite_link(const string &invite_link, Promise<Unit> &&promise) const {
|
||||
if (invite_link_infos_.count(invite_link) > 0) {
|
||||
return promise.set_value(Unit());
|
||||
|
@ -408,6 +408,8 @@ class ContactsManager : public Actor {
|
||||
|
||||
void delete_revoked_dialog_invite_link(DialogId dialog_id, const string &invite_link, Promise<Unit> &&promise);
|
||||
|
||||
void delete_all_revoked_dialog_invite_links(DialogId dialog_id, Promise<Unit> &&promise);
|
||||
|
||||
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);
|
||||
|
@ -6311,6 +6311,11 @@ void Td::on_request(uint64 id, td_api::deleteRevokedChatInviteLink &request) {
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::deleteAllRevokedChatInviteLinks &request) {
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
contacts_manager_->delete_all_revoked_dialog_invite_links(DialogId(request.chat_id_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::checkChatInviteLink &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.invite_link_);
|
||||
|
@ -796,6 +796,8 @@ class Td final : public NetQueryCallback {
|
||||
|
||||
void on_request(uint64 id, td_api::deleteRevokedChatInviteLink &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::deleteAllRevokedChatInviteLinks &request);
|
||||
|
||||
void on_request(uint64 id, td_api::checkChatInviteLink &request);
|
||||
|
||||
void on_request(uint64 id, td_api::joinChatByInviteLink &request);
|
||||
|
@ -2724,6 +2724,9 @@ class CliClient final : public Actor {
|
||||
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 == "darcil") {
|
||||
string chat_id = args;
|
||||
send_request(td_api::make_object<td_api::deleteAllRevokedChatInviteLinks>(as_chat_id(chat_id)));
|
||||
} else if (op == "ccil") {
|
||||
send_request(td_api::make_object<td_api::checkChatInviteLink>(args));
|
||||
} else if (op == "jcbil") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user