@mtcute/core 0.30.2 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.cjs +73 -0
- package/client.js +73 -0
- package/highlevel/client.d.cts +344 -114
- package/highlevel/client.d.ts +344 -114
- package/highlevel/methods/auth/sign-in-qr.cjs +2 -0
- package/highlevel/methods/auth/sign-in-qr.js +2 -0
- package/highlevel/methods/auth/sign-in-qr.test.d.cts +1 -0
- package/highlevel/methods/auth/sign-in-qr.test.d.ts +1 -0
- package/highlevel/methods/chats/join-chat.cjs +1 -1
- package/highlevel/methods/chats/join-chat.d.cts +2 -1
- package/highlevel/methods/chats/join-chat.d.ts +2 -1
- package/highlevel/methods/chats/join-chat.js +1 -1
- package/highlevel/methods/chats/transfer-chat-ownership.cjs +6 -17
- package/highlevel/methods/chats/transfer-chat-ownership.js +6 -17
- package/highlevel/methods/communities/ban-community-participant.cjs +30 -0
- package/highlevel/methods/communities/ban-community-participant.d.cts +20 -0
- package/highlevel/methods/communities/ban-community-participant.d.ts +20 -0
- package/highlevel/methods/communities/ban-community-participant.js +25 -0
- package/highlevel/methods/communities/create-community.cjs +29 -0
- package/highlevel/methods/communities/create-community.d.cts +22 -0
- package/highlevel/methods/communities/create-community.d.ts +22 -0
- package/highlevel/methods/communities/create-community.js +24 -0
- package/highlevel/methods/communities/get-community-link-requests.cjs +27 -0
- package/highlevel/methods/communities/get-community-link-requests.d.cts +17 -0
- package/highlevel/methods/communities/get-community-link-requests.d.ts +17 -0
- package/highlevel/methods/communities/get-community-link-requests.js +22 -0
- package/highlevel/methods/communities/get-community-participant-chats.cjs +24 -0
- package/highlevel/methods/communities/get-community-participant-chats.d.cts +17 -0
- package/highlevel/methods/communities/get-community-participant-chats.d.ts +17 -0
- package/highlevel/methods/communities/get-community-participant-chats.js +19 -0
- package/highlevel/methods/communities/get-joined-communities.cjs +21 -0
- package/highlevel/methods/communities/get-joined-communities.d.cts +6 -0
- package/highlevel/methods/communities/get-joined-communities.d.ts +6 -0
- package/highlevel/methods/communities/get-joined-communities.js +16 -0
- package/highlevel/methods/communities/hide-community-link-request.cjs +30 -0
- package/highlevel/methods/communities/hide-community-link-request.d.cts +22 -0
- package/highlevel/methods/communities/hide-community-link-request.d.ts +22 -0
- package/highlevel/methods/communities/hide-community-link-request.js +25 -0
- package/highlevel/methods/communities/link-community-peer.cjs +32 -0
- package/highlevel/methods/communities/link-community-peer.d.cts +22 -0
- package/highlevel/methods/communities/link-community-peer.d.ts +22 -0
- package/highlevel/methods/communities/link-community-peer.js +27 -0
- package/highlevel/methods/communities/toggle-community-collapsed.cjs +18 -0
- package/highlevel/methods/communities/toggle-community-collapsed.d.cts +16 -0
- package/highlevel/methods/communities/toggle-community-collapsed.d.ts +16 -0
- package/highlevel/methods/communities/toggle-community-collapsed.js +13 -0
- package/highlevel/methods/ephemeral/delete-ephemeral-message.cjs +20 -0
- package/highlevel/methods/ephemeral/delete-ephemeral-message.d.cts +13 -0
- package/highlevel/methods/ephemeral/delete-ephemeral-message.d.ts +13 -0
- package/highlevel/methods/ephemeral/delete-ephemeral-message.js +15 -0
- package/highlevel/methods/ephemeral/edit-ephemeral-message.cjs +33 -0
- package/highlevel/methods/ephemeral/edit-ephemeral-message.d.cts +25 -0
- package/highlevel/methods/ephemeral/edit-ephemeral-message.d.ts +25 -0
- package/highlevel/methods/ephemeral/edit-ephemeral-message.js +28 -0
- package/highlevel/methods/ephemeral/find-in-update.cjs +27 -0
- package/highlevel/methods/ephemeral/find-in-update.d.cts +8 -0
- package/highlevel/methods/ephemeral/find-in-update.d.ts +8 -0
- package/highlevel/methods/ephemeral/find-in-update.js +22 -0
- package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.cjs +31 -0
- package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.d.cts +29 -0
- package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.d.ts +29 -0
- package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.js +26 -0
- package/highlevel/methods/ephemeral/send-ephemeral-message.cjs +38 -0
- package/highlevel/methods/ephemeral/send-ephemeral-message.d.cts +29 -0
- package/highlevel/methods/ephemeral/send-ephemeral-message.d.ts +29 -0
- package/highlevel/methods/ephemeral/send-ephemeral-message.js +33 -0
- package/highlevel/methods/files/download-iterable.cjs +4 -2
- package/highlevel/methods/files/download-iterable.js +4 -2
- package/highlevel/methods/files/download-iterable.test.d.cts +1 -0
- package/highlevel/methods/files/download-iterable.test.d.ts +1 -0
- package/highlevel/methods/files/download-stream.cjs +5 -6
- package/highlevel/methods/files/download-stream.js +5 -6
- package/highlevel/methods/forums/create-forum-topic.d.cts +7 -0
- package/highlevel/methods/forums/create-forum-topic.d.ts +7 -0
- package/highlevel/methods/forums/delete-forum-topic-history.d.cts +1 -1
- package/highlevel/methods/forums/delete-forum-topic-history.d.ts +1 -1
- package/highlevel/methods/forums/edit-forum-topic.cjs +1 -1
- package/highlevel/methods/forums/edit-forum-topic.d.cts +2 -2
- package/highlevel/methods/forums/edit-forum-topic.d.ts +2 -2
- package/highlevel/methods/forums/edit-forum-topic.js +1 -1
- package/highlevel/methods/forums/get-forum-topics-by-id.cjs +5 -1
- package/highlevel/methods/forums/get-forum-topics-by-id.d.cts +9 -1
- package/highlevel/methods/forums/get-forum-topics-by-id.d.ts +9 -1
- package/highlevel/methods/forums/get-forum-topics-by-id.js +5 -1
- package/highlevel/methods/forums/get-forum-topics-by-id.test.d.cts +1 -0
- package/highlevel/methods/forums/get-forum-topics-by-id.test.d.ts +1 -0
- package/highlevel/methods/forums/get-forum-topics.cjs +1 -1
- package/highlevel/methods/forums/get-forum-topics.js +1 -1
- package/highlevel/methods/forums/toggle-forum-topic-closed.d.cts +1 -1
- package/highlevel/methods/forums/toggle-forum-topic-closed.d.ts +1 -1
- package/highlevel/methods/forums/toggle-forum-topic-pinned.d.cts +1 -1
- package/highlevel/methods/forums/toggle-forum-topic-pinned.d.ts +1 -1
- package/highlevel/methods/forums/toggle-general-topic-hidden.cjs +2 -2
- package/highlevel/methods/forums/toggle-general-topic-hidden.js +3 -3
- package/highlevel/methods/messages/send-common.d.cts +7 -1
- package/highlevel/methods/messages/send-common.d.ts +7 -1
- package/highlevel/methods/messages/send-text.cjs +70 -4
- package/highlevel/methods/messages/send-text.js +70 -4
- package/highlevel/methods/users/resolve-peer.cjs +11 -1
- package/highlevel/methods/users/resolve-peer.js +11 -1
- package/highlevel/methods.d.cts +16 -0
- package/highlevel/methods.d.ts +16 -0
- package/highlevel/storage/service/peers.cjs +25 -0
- package/highlevel/storage/service/peers.js +25 -0
- package/highlevel/storage/service/peers.test.d.cts +1 -0
- package/highlevel/storage/service/peers.test.d.ts +1 -0
- package/highlevel/types/conversation.cjs +8 -0
- package/highlevel/types/conversation.d.cts +1 -0
- package/highlevel/types/conversation.d.ts +1 -0
- package/highlevel/types/conversation.js +10 -2
- package/highlevel/types/conversation.test.d.cts +1 -0
- package/highlevel/types/conversation.test.d.ts +1 -0
- package/highlevel/types/messages/ephemeral-message.cjs +103 -0
- package/highlevel/types/messages/ephemeral-message.d.cts +55 -0
- package/highlevel/types/messages/ephemeral-message.d.ts +55 -0
- package/highlevel/types/messages/ephemeral-message.js +98 -0
- package/highlevel/types/messages/index.d.cts +1 -0
- package/highlevel/types/messages/index.d.ts +1 -0
- package/highlevel/types/messages/message-action.cjs +6 -0
- package/highlevel/types/messages/message-action.d.cts +8 -1
- package/highlevel/types/messages/message-action.d.ts +8 -1
- package/highlevel/types/messages/message-action.js +6 -0
- package/highlevel/types/messages/replied-message.cjs +5 -1
- package/highlevel/types/messages/replied-message.d.cts +5 -1
- package/highlevel/types/messages/replied-message.d.ts +5 -1
- package/highlevel/types/messages/replied-message.js +5 -1
- package/highlevel/types/peers/chat.cjs +23 -3
- package/highlevel/types/peers/chat.d.cts +8 -3
- package/highlevel/types/peers/chat.d.ts +8 -3
- package/highlevel/types/peers/chat.js +24 -4
- package/highlevel/types/peers/community-peer.cjs +60 -0
- package/highlevel/types/peers/community-peer.d.cts +37 -0
- package/highlevel/types/peers/community-peer.d.ts +37 -0
- package/highlevel/types/peers/community-peer.js +55 -0
- package/highlevel/types/peers/full-chat.cjs +20 -5
- package/highlevel/types/peers/full-chat.d.cts +5 -0
- package/highlevel/types/peers/full-chat.d.ts +5 -0
- package/highlevel/types/peers/full-chat.js +20 -5
- package/highlevel/types/peers/index.d.cts +1 -0
- package/highlevel/types/peers/index.d.ts +1 -0
- package/highlevel/types/peers/peer.cjs +2 -0
- package/highlevel/types/peers/peer.js +2 -0
- package/highlevel/types/peers/user.cjs +6 -0
- package/highlevel/types/peers/user.d.cts +2 -0
- package/highlevel/types/peers/user.d.ts +2 -0
- package/highlevel/types/peers/user.js +6 -0
- package/highlevel/types/updates/delete-ephemeral-messages-update.cjs +27 -0
- package/highlevel/types/updates/delete-ephemeral-messages-update.d.cts +15 -0
- package/highlevel/types/updates/delete-ephemeral-messages-update.d.ts +15 -0
- package/highlevel/types/updates/delete-ephemeral-messages-update.js +22 -0
- package/highlevel/types/updates/ephemeral-callback-query.cjs +61 -0
- package/highlevel/types/updates/ephemeral-callback-query.d.cts +38 -0
- package/highlevel/types/updates/ephemeral-callback-query.d.ts +38 -0
- package/highlevel/types/updates/ephemeral-callback-query.js +56 -0
- package/highlevel/types/updates/index.d.cts +16 -2
- package/highlevel/types/updates/index.d.ts +16 -2
- package/highlevel/types/updates/parse-update.cjs +12 -1
- package/highlevel/types/updates/parse-update.js +12 -1
- package/highlevel/updates/manager.cjs +31 -13
- package/highlevel/updates/manager.d.cts +1 -0
- package/highlevel/updates/manager.d.ts +1 -0
- package/highlevel/updates/manager.js +31 -13
- package/highlevel/updates/manager.test.d.cts +1 -0
- package/highlevel/updates/manager.test.d.ts +1 -0
- package/highlevel/utils/stream-utils.cjs +8 -4
- package/highlevel/utils/stream-utils.js +8 -4
- package/highlevel/utils/stream-utils.test.d.cts +1 -0
- package/highlevel/utils/stream-utils.test.d.ts +1 -0
- package/highlevel/utils/walk-page-blocks.cjs +4 -0
- package/highlevel/utils/walk-page-blocks.js +4 -0
- package/index.cjs +10 -0
- package/index.js +11 -1
- package/methods.cjs +27 -0
- package/methods.js +27 -0
- package/network/client.cjs +4 -3
- package/network/client.d.cts +1 -0
- package/network/client.d.ts +1 -0
- package/network/client.js +4 -3
- package/network/middlewares/flood-waiter.cjs +2 -2
- package/network/middlewares/flood-waiter.js +2 -2
- package/network/middlewares/internal-errors.cjs +1 -1
- package/network/middlewares/internal-errors.js +1 -1
- package/network/middlewares/media-throttle.cjs +1 -1
- package/network/middlewares/media-throttle.js +1 -1
- package/network/mtproxy/index.cjs +4 -3
- package/network/mtproxy/index.d.cts +2 -2
- package/network/mtproxy/index.d.ts +2 -2
- package/network/mtproxy/index.js +4 -3
- package/network/network-manager.cjs +44 -16
- package/network/network-manager.d.cts +10 -3
- package/network/network-manager.d.ts +10 -3
- package/network/network-manager.js +45 -17
- package/network/network-manager.test.d.cts +1 -0
- package/network/network-manager.test.d.ts +1 -0
- package/network/persistent-connection.cjs +10 -2
- package/network/persistent-connection.js +10 -2
- package/network/session-connection.cjs +3 -0
- package/network/session-connection.js +3 -0
- package/network/transports/abstract.cjs +16 -0
- package/network/transports/abstract.d.cts +8 -2
- package/network/transports/abstract.d.ts +8 -2
- package/network/transports/abstract.js +17 -1
- package/network/transports/obfuscated.cjs +3 -1
- package/network/transports/obfuscated.js +3 -1
- package/package.json +6 -6
- package/tl/api-schema.json +1 -1
- package/tl/binary/reader.cjs +90 -15
- package/tl/binary/reader.js +90 -15
- package/tl/binary/writer.cjs +385 -80
- package/tl/binary/writer.js +385 -80
- package/tl/compat/reader.cjs +11 -0
- package/tl/compat/reader.js +11 -0
- package/tl/index.d.cts +12380 -4272
- package/tl/index.d.ts +12380 -4272
- package/tl/inner-tl.cjs +70 -20
- package/tl/inner-tl.js +70 -20
- package/tl/raw-errors.json +1 -1
- package/utils/abort-signal.cjs +1 -12
- package/utils/abort-signal.js +1 -12
- package/utils/abort-signal.test.d.cts +1 -0
- package/utils/abort-signal.test.d.ts +1 -0
- package/utils/binary/compat.cjs +14 -0
- package/utils/binary/compat.js +14 -0
- package/utils/early-timer.cjs +3 -11
- package/utils/early-timer.js +3 -11
- package/utils/early-timer.test.d.cts +1 -0
- package/utils/early-timer.test.d.ts +1 -0
- package/utils/function-utils.cjs +9 -4
- package/utils/function-utils.js +9 -4
- package/utils/links/bots.cjs +3 -0
- package/utils/links/bots.js +3 -0
- package/utils/peer-utils.cjs +8 -0
- package/utils/peer-utils.js +8 -0
|
@@ -85,7 +85,9 @@ async function signInQr(client, params) {
|
|
|
85
85
|
]);
|
|
86
86
|
break;
|
|
87
87
|
case "auth.loginTokenMigrateTo": {
|
|
88
|
+
abortSignal?.throwIfAborted();
|
|
88
89
|
await client.changePrimaryDc(res.dcId);
|
|
90
|
+
abortSignal?.throwIfAborted();
|
|
89
91
|
let res2;
|
|
90
92
|
try {
|
|
91
93
|
res2 = await client.call(
|
|
@@ -78,7 +78,9 @@ async function signInQr(client, params) {
|
|
|
78
78
|
]);
|
|
79
79
|
break;
|
|
80
80
|
case "auth.loginTokenMigrateTo": {
|
|
81
|
+
abortSignal?.throwIfAborted();
|
|
81
82
|
await client.changePrimaryDc(res.dcId);
|
|
83
|
+
abortSignal?.throwIfAborted();
|
|
82
84
|
let res2;
|
|
83
85
|
try {
|
|
84
86
|
res2 = await client.call(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,6 +7,7 @@ import { tl } from '../../../tl/index.js';
|
|
|
7
7
|
* - `status: 'ok'` - the chat was joined successfully
|
|
8
8
|
* - `status: 'request_sent'` - a join request was sent and needs to be approved by the chat admin
|
|
9
9
|
* - `status: 'webview'` - a guard bot requested you to open a webview before joining the chat
|
|
10
|
+
* (use `messages.requestChatJoinWebView` with `queryId` to obtain the webview url)
|
|
10
11
|
*/
|
|
11
12
|
export type JoinChatResult = {
|
|
12
13
|
status: 'ok';
|
|
@@ -16,7 +17,7 @@ export type JoinChatResult = {
|
|
|
16
17
|
} | {
|
|
17
18
|
status: 'webview';
|
|
18
19
|
bot: User;
|
|
19
|
-
|
|
20
|
+
queryId: tl.Long;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* Join a channel or supergroup
|
|
@@ -7,6 +7,7 @@ import { tl } from '../../../tl/index.js';
|
|
|
7
7
|
* - `status: 'ok'` - the chat was joined successfully
|
|
8
8
|
* - `status: 'request_sent'` - a join request was sent and needs to be approved by the chat admin
|
|
9
9
|
* - `status: 'webview'` - a guard bot requested you to open a webview before joining the chat
|
|
10
|
+
* (use `messages.requestChatJoinWebView` with `queryId` to obtain the webview url)
|
|
10
11
|
*/
|
|
11
12
|
export type JoinChatResult = {
|
|
12
13
|
status: 'ok';
|
|
@@ -16,7 +17,7 @@ export type JoinChatResult = {
|
|
|
16
17
|
} | {
|
|
17
18
|
status: 'webview';
|
|
18
19
|
bot: User;
|
|
19
|
-
|
|
20
|
+
queryId: tl.Long;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* Join a channel or supergroup
|
|
@@ -5,7 +5,6 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
const peerUtils = require("../../utils/peer-utils.cjs");
|
|
9
8
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
10
9
|
async function transferChatOwnership(client, params) {
|
|
11
10
|
const { chatId, userId } = params;
|
|
@@ -15,22 +14,12 @@ async function transferChatOwnership(client, params) {
|
|
|
15
14
|
await client.call({ _: "account.getPassword" }),
|
|
16
15
|
params.password
|
|
17
16
|
);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
password
|
|
25
|
-
});
|
|
26
|
-
} else {
|
|
27
|
-
res = await client.call({
|
|
28
|
-
_: "messages.editChatCreator",
|
|
29
|
-
peer,
|
|
30
|
-
userId: user,
|
|
31
|
-
password
|
|
32
|
-
});
|
|
33
|
-
}
|
|
17
|
+
const res = await client.call({
|
|
18
|
+
_: "messages.editChatCreator",
|
|
19
|
+
peer,
|
|
20
|
+
userId: user,
|
|
21
|
+
password
|
|
22
|
+
});
|
|
34
23
|
client.handleClientUpdate(res);
|
|
35
24
|
}
|
|
36
25
|
exports.transferChatOwnership = transferChatOwnership;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isInputPeerChannel, toInputChannel } from "../../utils/peer-utils.js";
|
|
2
1
|
import { resolvePeer, resolveUser } from "../users/resolve-peer.js";
|
|
3
2
|
async function transferChatOwnership(client, params) {
|
|
4
3
|
const { chatId, userId } = params;
|
|
@@ -8,22 +7,12 @@ async function transferChatOwnership(client, params) {
|
|
|
8
7
|
await client.call({ _: "account.getPassword" }),
|
|
9
8
|
params.password
|
|
10
9
|
);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
password
|
|
18
|
-
});
|
|
19
|
-
} else {
|
|
20
|
-
res = await client.call({
|
|
21
|
-
_: "messages.editChatCreator",
|
|
22
|
-
peer,
|
|
23
|
-
userId: user,
|
|
24
|
-
password
|
|
25
|
-
});
|
|
26
|
-
}
|
|
10
|
+
const res = await client.call({
|
|
11
|
+
_: "messages.editChatCreator",
|
|
12
|
+
peer,
|
|
13
|
+
userId: user,
|
|
14
|
+
password
|
|
15
|
+
});
|
|
27
16
|
client.handleClientUpdate(res);
|
|
28
17
|
}
|
|
29
18
|
export {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
9
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
10
|
+
async function banCommunityParticipant(client, params) {
|
|
11
|
+
const { communityId, participantId } = params;
|
|
12
|
+
const r = await client.call({
|
|
13
|
+
_: "communities.toggleParticipantBanned",
|
|
14
|
+
community: await resolvePeer.resolveChannel(client, communityId),
|
|
15
|
+
participant: await resolvePeer.resolvePeer(client, participantId)
|
|
16
|
+
});
|
|
17
|
+
typeAssertions.assertTrue("communities.toggleParticipantBanned", r);
|
|
18
|
+
}
|
|
19
|
+
async function unbanCommunityParticipant(client, params) {
|
|
20
|
+
const { communityId, participantId } = params;
|
|
21
|
+
const r = await client.call({
|
|
22
|
+
_: "communities.toggleParticipantBanned",
|
|
23
|
+
community: await resolvePeer.resolveChannel(client, communityId),
|
|
24
|
+
participant: await resolvePeer.resolvePeer(client, participantId),
|
|
25
|
+
unban: true
|
|
26
|
+
});
|
|
27
|
+
typeAssertions.assertTrue("communities.toggleParticipantBanned", r);
|
|
28
|
+
}
|
|
29
|
+
exports.banCommunityParticipant = banCommunityParticipant;
|
|
30
|
+
exports.unbanCommunityParticipant = unbanCommunityParticipant;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Ban a participant from a community
|
|
5
|
+
*/
|
|
6
|
+
export declare function banCommunityParticipant(client: ITelegramClient, params: {
|
|
7
|
+
/** Community ID */
|
|
8
|
+
communityId: InputPeerLike;
|
|
9
|
+
/** Participant to ban */
|
|
10
|
+
participantId: InputPeerLike;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Unban a participant from a community
|
|
14
|
+
*/
|
|
15
|
+
export declare function unbanCommunityParticipant(client: ITelegramClient, params: {
|
|
16
|
+
/** Community ID */
|
|
17
|
+
communityId: InputPeerLike;
|
|
18
|
+
/** Participant to unban */
|
|
19
|
+
participantId: InputPeerLike;
|
|
20
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Ban a participant from a community
|
|
5
|
+
*/
|
|
6
|
+
export declare function banCommunityParticipant(client: ITelegramClient, params: {
|
|
7
|
+
/** Community ID */
|
|
8
|
+
communityId: InputPeerLike;
|
|
9
|
+
/** Participant to ban */
|
|
10
|
+
participantId: InputPeerLike;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Unban a participant from a community
|
|
14
|
+
*/
|
|
15
|
+
export declare function unbanCommunityParticipant(client: ITelegramClient, params: {
|
|
16
|
+
/** Community ID */
|
|
17
|
+
communityId: InputPeerLike;
|
|
18
|
+
/** Participant to unban */
|
|
19
|
+
participantId: InputPeerLike;
|
|
20
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { assertTrue } from "../../../utils/type-assertions.js";
|
|
2
|
+
import { resolvePeer, resolveChannel } from "../users/resolve-peer.js";
|
|
3
|
+
async function banCommunityParticipant(client, params) {
|
|
4
|
+
const { communityId, participantId } = params;
|
|
5
|
+
const r = await client.call({
|
|
6
|
+
_: "communities.toggleParticipantBanned",
|
|
7
|
+
community: await resolveChannel(client, communityId),
|
|
8
|
+
participant: await resolvePeer(client, participantId)
|
|
9
|
+
});
|
|
10
|
+
assertTrue("communities.toggleParticipantBanned", r);
|
|
11
|
+
}
|
|
12
|
+
async function unbanCommunityParticipant(client, params) {
|
|
13
|
+
const { communityId, participantId } = params;
|
|
14
|
+
const r = await client.call({
|
|
15
|
+
_: "communities.toggleParticipantBanned",
|
|
16
|
+
community: await resolveChannel(client, communityId),
|
|
17
|
+
participant: await resolvePeer(client, participantId),
|
|
18
|
+
unban: true
|
|
19
|
+
});
|
|
20
|
+
assertTrue("communities.toggleParticipantBanned", r);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
banCommunityParticipant,
|
|
24
|
+
unbanCommunityParticipant
|
|
25
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const errors = require("../../../types/errors.cjs");
|
|
9
|
+
const utils = require("../../updates/utils.cjs");
|
|
10
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
11
|
+
const chat = require("../../types/peers/chat.cjs");
|
|
12
|
+
async function createCommunity(client, params) {
|
|
13
|
+
const { title, chatId, about, hidden, shouldDispatch } = params;
|
|
14
|
+
const res = await client.call({
|
|
15
|
+
_: "communities.create",
|
|
16
|
+
title,
|
|
17
|
+
about,
|
|
18
|
+
hidden,
|
|
19
|
+
peer: await resolvePeer.resolvePeer(client, chatId)
|
|
20
|
+
});
|
|
21
|
+
utils.assertIsUpdatesGroup("communities.create", res);
|
|
22
|
+
client.handleClientUpdate(res, !shouldDispatch);
|
|
23
|
+
const community = res.chats.find((it) => it._ === "community");
|
|
24
|
+
if (!community) {
|
|
25
|
+
throw new errors.MtTypeAssertionError("communities.create (@ .chats)", "community", "none");
|
|
26
|
+
}
|
|
27
|
+
return new chat.Chat(community);
|
|
28
|
+
}
|
|
29
|
+
exports.createCommunity = createCommunity;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, Chat } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a new community
|
|
5
|
+
*
|
|
6
|
+
* @returns Newly created community
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCommunity(client: ITelegramClient, params: {
|
|
9
|
+
/** Community title */
|
|
10
|
+
title: string;
|
|
11
|
+
/** Chat to link to the community */
|
|
12
|
+
chatId: InputPeerLike;
|
|
13
|
+
/** Community description */
|
|
14
|
+
about?: string;
|
|
15
|
+
/** Whether the community should be hidden */
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to dispatch the returned updates
|
|
19
|
+
* to the client's update handler.
|
|
20
|
+
*/
|
|
21
|
+
shouldDispatch?: true;
|
|
22
|
+
}): Promise<Chat>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, Chat } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a new community
|
|
5
|
+
*
|
|
6
|
+
* @returns Newly created community
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCommunity(client: ITelegramClient, params: {
|
|
9
|
+
/** Community title */
|
|
10
|
+
title: string;
|
|
11
|
+
/** Chat to link to the community */
|
|
12
|
+
chatId: InputPeerLike;
|
|
13
|
+
/** Community description */
|
|
14
|
+
about?: string;
|
|
15
|
+
/** Whether the community should be hidden */
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to dispatch the returned updates
|
|
19
|
+
* to the client's update handler.
|
|
20
|
+
*/
|
|
21
|
+
shouldDispatch?: true;
|
|
22
|
+
}): Promise<Chat>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MtTypeAssertionError } from "../../../types/errors.js";
|
|
2
|
+
import { assertIsUpdatesGroup } from "../../updates/utils.js";
|
|
3
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
4
|
+
import { Chat as Chat$2 } from "../../types/peers/chat.js";
|
|
5
|
+
async function createCommunity(client, params) {
|
|
6
|
+
const { title, chatId, about, hidden, shouldDispatch } = params;
|
|
7
|
+
const res = await client.call({
|
|
8
|
+
_: "communities.create",
|
|
9
|
+
title,
|
|
10
|
+
about,
|
|
11
|
+
hidden,
|
|
12
|
+
peer: await resolvePeer(client, chatId)
|
|
13
|
+
});
|
|
14
|
+
assertIsUpdatesGroup("communities.create", res);
|
|
15
|
+
client.handleClientUpdate(res, !shouldDispatch);
|
|
16
|
+
const community = res.chats.find((it) => it._ === "community");
|
|
17
|
+
if (!community) {
|
|
18
|
+
throw new MtTypeAssertionError("communities.create (@ .chats)", "community", "none");
|
|
19
|
+
}
|
|
20
|
+
return new Chat$2(community);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
createCommunity
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
9
|
+
const miscUtils = require("../../utils/misc-utils.cjs");
|
|
10
|
+
const communityPeer = require("../../types/peers/community-peer.cjs");
|
|
11
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
12
|
+
async function getCommunityLinkRequests(client, communityId, params) {
|
|
13
|
+
const { offset = "", limit = 100 } = params ?? {};
|
|
14
|
+
const res = await client.call({
|
|
15
|
+
_: "communities.getPeerLinkRequests",
|
|
16
|
+
community: await resolvePeer.resolveChannel(client, communityId),
|
|
17
|
+
offset,
|
|
18
|
+
limit
|
|
19
|
+
});
|
|
20
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
21
|
+
return miscUtils.makeArrayPaginated(
|
|
22
|
+
res.requests.map((it) => new communityPeer.CommunityPeerRequest(it, peers)),
|
|
23
|
+
res.totalCount,
|
|
24
|
+
res.nextOffset
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
exports.getCommunityLinkRequests = getCommunityLinkRequests;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { ArrayPaginated, InputPeerLike, CommunityPeerRequest } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get pending peer link requests for a community
|
|
5
|
+
*
|
|
6
|
+
* @param communityId Community ID
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCommunityLinkRequests(client: ITelegramClient, communityId: InputPeerLike, params?: {
|
|
9
|
+
/** Offset for pagination */
|
|
10
|
+
offset?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of requests to fetch
|
|
13
|
+
*
|
|
14
|
+
* @default 100
|
|
15
|
+
*/
|
|
16
|
+
limit?: number;
|
|
17
|
+
}): Promise<ArrayPaginated<CommunityPeerRequest, string>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { ArrayPaginated, InputPeerLike, CommunityPeerRequest } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get pending peer link requests for a community
|
|
5
|
+
*
|
|
6
|
+
* @param communityId Community ID
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCommunityLinkRequests(client: ITelegramClient, communityId: InputPeerLike, params?: {
|
|
9
|
+
/** Offset for pagination */
|
|
10
|
+
offset?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of requests to fetch
|
|
13
|
+
*
|
|
14
|
+
* @default 100
|
|
15
|
+
*/
|
|
16
|
+
limit?: number;
|
|
17
|
+
}): Promise<ArrayPaginated<CommunityPeerRequest, string>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { resolveChannel } from "../users/resolve-peer.js";
|
|
2
|
+
import { makeArrayPaginated } from "../../utils/misc-utils.js";
|
|
3
|
+
import { CommunityPeerRequest as CommunityPeerRequest$2 } from "../../types/peers/community-peer.js";
|
|
4
|
+
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
5
|
+
async function getCommunityLinkRequests(client, communityId, params) {
|
|
6
|
+
const { offset = "", limit = 100 } = params ?? {};
|
|
7
|
+
const res = await client.call({
|
|
8
|
+
_: "communities.getPeerLinkRequests",
|
|
9
|
+
community: await resolveChannel(client, communityId),
|
|
10
|
+
offset,
|
|
11
|
+
limit
|
|
12
|
+
});
|
|
13
|
+
const peers = PeersIndex.from(res);
|
|
14
|
+
return makeArrayPaginated(
|
|
15
|
+
res.requests.map((it) => new CommunityPeerRequest$2(it, peers)),
|
|
16
|
+
res.totalCount,
|
|
17
|
+
res.nextOffset
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
getCommunityLinkRequests
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
9
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
10
|
+
const chat = require("../../types/peers/chat.cjs");
|
|
11
|
+
async function getCommunityParticipantChats(client, params) {
|
|
12
|
+
const { communityId, participantId } = params;
|
|
13
|
+
const res = await client.call({
|
|
14
|
+
_: "communities.getParticipantJoinedChats",
|
|
15
|
+
community: await resolvePeer.resolveChannel(client, communityId),
|
|
16
|
+
participant: await resolvePeer.resolvePeer(client, participantId)
|
|
17
|
+
});
|
|
18
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
19
|
+
return {
|
|
20
|
+
creatorChats: res.creatorChatIds.map((it) => new chat.Chat(peers.chat(it))),
|
|
21
|
+
joinedChats: res.joinedChatIds.map((it) => new chat.Chat(peers.chat(it)))
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
exports.getCommunityParticipantChats = getCommunityParticipantChats;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, Chat } from '../../types/index.js';
|
|
3
|
+
export interface CommunityParticipantChats {
|
|
4
|
+
/** Chats linked to the community that the participant has created */
|
|
5
|
+
creatorChats: Chat[];
|
|
6
|
+
/** Chats linked to the community that the participant has joined */
|
|
7
|
+
joinedChats: Chat[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get chats linked to a community that the given participant has joined or created
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCommunityParticipantChats(client: ITelegramClient, params: {
|
|
13
|
+
/** Community ID */
|
|
14
|
+
communityId: InputPeerLike;
|
|
15
|
+
/** Participant to fetch the chats for */
|
|
16
|
+
participantId: InputPeerLike;
|
|
17
|
+
}): Promise<CommunityParticipantChats>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, Chat } from '../../types/index.js';
|
|
3
|
+
export interface CommunityParticipantChats {
|
|
4
|
+
/** Chats linked to the community that the participant has created */
|
|
5
|
+
creatorChats: Chat[];
|
|
6
|
+
/** Chats linked to the community that the participant has joined */
|
|
7
|
+
joinedChats: Chat[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get chats linked to a community that the given participant has joined or created
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCommunityParticipantChats(client: ITelegramClient, params: {
|
|
13
|
+
/** Community ID */
|
|
14
|
+
communityId: InputPeerLike;
|
|
15
|
+
/** Participant to fetch the chats for */
|
|
16
|
+
participantId: InputPeerLike;
|
|
17
|
+
}): Promise<CommunityParticipantChats>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { resolvePeer, resolveChannel } from "../users/resolve-peer.js";
|
|
2
|
+
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
3
|
+
import { Chat as Chat$2 } from "../../types/peers/chat.js";
|
|
4
|
+
async function getCommunityParticipantChats(client, params) {
|
|
5
|
+
const { communityId, participantId } = params;
|
|
6
|
+
const res = await client.call({
|
|
7
|
+
_: "communities.getParticipantJoinedChats",
|
|
8
|
+
community: await resolveChannel(client, communityId),
|
|
9
|
+
participant: await resolvePeer(client, participantId)
|
|
10
|
+
});
|
|
11
|
+
const peers = PeersIndex.from(res);
|
|
12
|
+
return {
|
|
13
|
+
creatorChats: res.creatorChatIds.map((it) => new Chat$2(peers.chat(it))),
|
|
14
|
+
joinedChats: res.joinedChatIds.map((it) => new Chat$2(peers.chat(it)))
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
getCommunityParticipantChats
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const chat = require("../../types/peers/chat.cjs");
|
|
9
|
+
async function getJoinedCommunities(client) {
|
|
10
|
+
const res = await client.call({
|
|
11
|
+
_: "communities.getJoinedCommunities"
|
|
12
|
+
});
|
|
13
|
+
const ret = [];
|
|
14
|
+
for (const chat$1 of res.chats) {
|
|
15
|
+
if (chat$1._ === "community" || chat$1._ === "communityForbidden") {
|
|
16
|
+
ret.push(new chat.Chat(chat$1));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return ret;
|
|
20
|
+
}
|
|
21
|
+
exports.getJoinedCommunities = getJoinedCommunities;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Chat as Chat$2 } from "../../types/peers/chat.js";
|
|
2
|
+
async function getJoinedCommunities(client) {
|
|
3
|
+
const res = await client.call({
|
|
4
|
+
_: "communities.getJoinedCommunities"
|
|
5
|
+
});
|
|
6
|
+
const ret = [];
|
|
7
|
+
for (const chat of res.chats) {
|
|
8
|
+
if (chat._ === "community" || chat._ === "communityForbidden") {
|
|
9
|
+
ret.push(new Chat$2(chat));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return ret;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
getJoinedCommunities
|
|
16
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
9
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
10
|
+
async function hideCommunityLinkRequest(client, params) {
|
|
11
|
+
const { communityId, peerId, action } = params;
|
|
12
|
+
const r = await client.call({
|
|
13
|
+
_: "communities.togglePeerLinkRequestApproval",
|
|
14
|
+
community: await resolvePeer.resolveChannel(client, communityId),
|
|
15
|
+
peer: await resolvePeer.resolvePeer(client, peerId),
|
|
16
|
+
reject: action === "decline" || void 0
|
|
17
|
+
});
|
|
18
|
+
typeAssertions.assertTrue("communities.togglePeerLinkRequestApproval", r);
|
|
19
|
+
}
|
|
20
|
+
async function hideAllCommunityLinkRequests(client, params) {
|
|
21
|
+
const { communityId, action } = params;
|
|
22
|
+
const r = await client.call({
|
|
23
|
+
_: "communities.toggleAllPeerLinkRequestApproval",
|
|
24
|
+
community: await resolvePeer.resolveChannel(client, communityId),
|
|
25
|
+
reject: action === "decline" || void 0
|
|
26
|
+
});
|
|
27
|
+
typeAssertions.assertTrue("communities.toggleAllPeerLinkRequestApproval", r);
|
|
28
|
+
}
|
|
29
|
+
exports.hideAllCommunityLinkRequests = hideAllCommunityLinkRequests;
|
|
30
|
+
exports.hideCommunityLinkRequest = hideCommunityLinkRequest;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Approve or decline a peer link request to a community
|
|
5
|
+
*/
|
|
6
|
+
export declare function hideCommunityLinkRequest(client: ITelegramClient, params: {
|
|
7
|
+
/** Community ID */
|
|
8
|
+
communityId: InputPeerLike;
|
|
9
|
+
/** Peer whose link request should be approved/declined */
|
|
10
|
+
peerId: InputPeerLike;
|
|
11
|
+
/** Whether to approve or decline the request */
|
|
12
|
+
action: 'approve' | 'decline';
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Approve or decline all pending peer link requests to a community
|
|
16
|
+
*/
|
|
17
|
+
export declare function hideAllCommunityLinkRequests(client: ITelegramClient, params: {
|
|
18
|
+
/** Community ID */
|
|
19
|
+
communityId: InputPeerLike;
|
|
20
|
+
/** Whether to approve or decline the requests */
|
|
21
|
+
action: 'approve' | 'decline';
|
|
22
|
+
}): Promise<void>;
|