@mtkruto/browser 0.119.0 → 0.119.1
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/esm/0_errors.d.ts.map +1 -1
- package/esm/0_errors.js +9 -31
- package/esm/3_errors.js +2 -12
- package/esm/4_errors.js +2 -12
- package/esm/_dnt.polyfills.d.ts +0 -99
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +1 -127
- package/esm/client/0_abortable_loop.js +26 -39
- package/esm/client/0_storage_operations.js +179 -218
- package/esm/client/1_client_plain.js +4 -22
- package/esm/client/2_account_manager.js +140 -149
- package/esm/client/2_bot_info_manager.js +26 -38
- package/esm/client/2_business_connection_manager.js +10 -23
- package/esm/client/2_client_encrypted.js +198 -215
- package/esm/client/2_file_manager.js +255 -262
- package/esm/client/2_network_statistics_manager.js +31 -44
- package/esm/client/2_payment_manager.js +7 -20
- package/esm/client/2_reaction_manager.js +7 -20
- package/esm/client/2_translations_manager.js +101 -111
- package/esm/client/2_update_manager.js +750 -745
- package/esm/client/3_client_encrypted_pool.js +10 -26
- package/esm/client/3_message_manager.js +503 -508
- package/esm/client/3_video_chat_manager.js +57 -68
- package/esm/client/4_callback_query_manager.js +18 -30
- package/esm/client/4_chat_list_manager.js +140 -146
- package/esm/client/4_chat_manager.js +161 -169
- package/esm/client/4_checklist_manager.js +26 -39
- package/esm/client/4_context.js +244 -259
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.js +22 -35
- package/esm/client/4_inline_query_manager.js +16 -28
- package/esm/client/4_link_preview_manager.js +6 -19
- package/esm/client/4_poll_manager.js +44 -57
- package/esm/client/4_story_manager.js +41 -53
- package/esm/client/5_composer.js +13 -26
- package/esm/client/6_client.js +866 -896
- package/esm/client/6_client_dispatcher.js +308 -325
- package/esm/client/7_client_worker.js +16 -29
- package/esm/connection/1_connection_tcp.js +55 -82
- package/esm/connection/1_connection_web_socket.js +75 -91
- package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/esm/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
- package/esm/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
- package/esm/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.js +422 -420
- package/esm/storage/2_storage_indexed_db.js +26 -44
- package/esm/storage/2_storage_local_storage.js +3 -16
- package/esm/storage/2_storage_memory.js +24 -41
- package/esm/storage/2_storage_session_storage.js +3 -16
- package/esm/tl/1_tl_reader.d.ts +1 -1
- package/esm/tl/1_tl_reader.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +95 -103
- package/esm/tl/1_tl_writer.js +169 -178
- package/esm/transport/0_transport.js +1 -8
- package/esm/transport/1_transport_abridged.js +11 -24
- package/esm/transport/1_transport_intermediate.js +10 -23
- package/esm/utilities/0_mutex.js +4 -19
- package/esm/utilities/0_part_stream.js +11 -25
- package/esm/utilities/1_crypto.js +42 -53
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_errors.d.ts.map +1 -1
- package/script/0_errors.js +9 -31
- package/script/3_errors.js +2 -12
- package/script/4_errors.js +2 -12
- package/script/_dnt.polyfills.d.ts +0 -99
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +0 -128
- package/script/client/0_abortable_loop.js +27 -40
- package/script/client/0_storage_operations.js +179 -218
- package/script/client/1_client_plain.js +4 -22
- package/script/client/2_account_manager.js +140 -149
- package/script/client/2_bot_info_manager.js +26 -38
- package/script/client/2_business_connection_manager.js +10 -23
- package/script/client/2_client_encrypted.js +199 -216
- package/script/client/2_file_manager.js +255 -262
- package/script/client/2_network_statistics_manager.js +32 -45
- package/script/client/2_payment_manager.js +7 -20
- package/script/client/2_reaction_manager.js +7 -20
- package/script/client/2_translations_manager.js +102 -112
- package/script/client/2_update_manager.js +750 -745
- package/script/client/3_client_encrypted_pool.js +10 -26
- package/script/client/3_message_manager.js +503 -508
- package/script/client/3_video_chat_manager.js +57 -68
- package/script/client/4_callback_query_manager.js +18 -30
- package/script/client/4_chat_list_manager.js +140 -146
- package/script/client/4_chat_manager.js +161 -169
- package/script/client/4_checklist_manager.js +26 -39
- package/script/client/4_context.js +244 -259
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.js +22 -35
- package/script/client/4_inline_query_manager.js +16 -28
- package/script/client/4_link_preview_manager.js +6 -19
- package/script/client/4_poll_manager.js +44 -57
- package/script/client/4_story_manager.js +41 -53
- package/script/client/5_composer.js +13 -26
- package/script/client/6_client.js +866 -896
- package/script/client/6_client_dispatcher.js +308 -325
- package/script/client/7_client_worker.js +16 -29
- package/script/connection/1_connection_tcp.js +55 -82
- package/script/connection/1_connection_web_socket.js +75 -91
- package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/script/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
- package/script/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
- package/script/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.js +49 -72
- package/script/session/2_session_encrypted.js +423 -421
- package/script/storage/2_storage_indexed_db.js +26 -44
- package/script/storage/2_storage_local_storage.js +3 -16
- package/script/storage/2_storage_memory.js +24 -41
- package/script/storage/2_storage_session_storage.js +3 -16
- package/script/tl/1_tl_reader.d.ts +1 -1
- package/script/tl/1_tl_reader.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +96 -104
- package/script/tl/1_tl_writer.js +170 -179
- package/script/transport/0_transport.js +1 -8
- package/script/transport/1_transport_abridged.js +11 -24
- package/script/transport/1_transport_intermediate.js +10 -23
- package/script/utilities/0_mutex.js +4 -19
- package/script/utilities/0_part_stream.js +11 -25
- package/script/utilities/1_crypto.js +43 -54
- package/script/utilities/2_queue.js +30 -48
|
@@ -18,18 +18,6 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _ChatManager_instances, _ChatManager_c, _ChatManager_toggleJoinRequests, _ChatManager_toggleSlowMode, _ChatManager_setIsMemberListVisible, _ChatManager_setIsTopicsEnabled, _ChatManager_setIsAntispamEnabled, _ChatManager_setIsSignaturesEnabled, _ChatManager_setIsSharingEnabled;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.ChatManager = void 0;
|
|
35
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -46,18 +34,17 @@ const chatManagerUpdates = [
|
|
|
46
34
|
"updateBotChatInviteRequester",
|
|
47
35
|
];
|
|
48
36
|
class ChatManager {
|
|
37
|
+
#c;
|
|
49
38
|
constructor(c) {
|
|
50
|
-
|
|
51
|
-
_ChatManager_c.set(this, void 0);
|
|
52
|
-
__classPrivateFieldSet(this, _ChatManager_c, c, "f");
|
|
39
|
+
this.#c = c;
|
|
53
40
|
}
|
|
54
41
|
canHandleUpdate(update) {
|
|
55
42
|
return _2_tl_js_1.Api.isOneOf(chatManagerUpdates, update);
|
|
56
43
|
}
|
|
57
44
|
async handleUpdate(update) {
|
|
58
45
|
if (_2_tl_js_1.Api.is("updateChannelParticipant", update) || _2_tl_js_1.Api.is("updateChatParticipant", update)) {
|
|
59
|
-
const chatMember = (0, _3_types_js_1.constructChatMemberUpdated)(update,
|
|
60
|
-
const selfId = await
|
|
46
|
+
const chatMember = (0, _3_types_js_1.constructChatMemberUpdated)(update, this.#c.getPeer);
|
|
47
|
+
const selfId = await this.#c.getSelfId();
|
|
61
48
|
if (chatMember.oldChatMember.member.id === selfId) {
|
|
62
49
|
return { myChatMember: chatMember };
|
|
63
50
|
}
|
|
@@ -66,51 +53,56 @@ class ChatManager {
|
|
|
66
53
|
}
|
|
67
54
|
}
|
|
68
55
|
if (_2_tl_js_1.Api.is("updateBotChatInviteRequester", update)) {
|
|
69
|
-
const joinRequest = (0, _3_types_js_1.constructJoinRequest)(update,
|
|
56
|
+
const joinRequest = (0, _3_types_js_1.constructJoinRequest)(update, this.#c.getPeer);
|
|
70
57
|
return { joinRequest };
|
|
71
58
|
}
|
|
72
59
|
return null;
|
|
73
60
|
}
|
|
61
|
+
// JOIN REQUESTS //
|
|
62
|
+
async #toggleJoinRequests(chatId, isEnabled) {
|
|
63
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
64
|
+
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled: isEnabled });
|
|
65
|
+
}
|
|
74
66
|
async approveJoinRequest(chatId, userId) {
|
|
75
|
-
await
|
|
67
|
+
await this.#c.invoke({
|
|
76
68
|
_: "messages.hideChatJoinRequest",
|
|
77
|
-
peer: await
|
|
78
|
-
user_id: await
|
|
69
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
70
|
+
user_id: await this.#c.getInputUser(userId),
|
|
79
71
|
approved: true,
|
|
80
72
|
});
|
|
81
73
|
}
|
|
82
74
|
async declineJoinRequest(chatId, userId) {
|
|
83
|
-
await
|
|
75
|
+
await this.#c.invoke({
|
|
84
76
|
_: "messages.hideChatJoinRequest",
|
|
85
|
-
peer: await
|
|
86
|
-
user_id: await
|
|
77
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
78
|
+
user_id: await this.#c.getInputUser(userId),
|
|
87
79
|
});
|
|
88
80
|
}
|
|
89
81
|
async approveJoinRequests(chatId, params) {
|
|
90
|
-
|
|
91
|
-
await
|
|
82
|
+
this.#c.storage.assertUser("approveJoinRequests");
|
|
83
|
+
await this.#c.invoke({
|
|
92
84
|
_: "messages.hideAllChatJoinRequests",
|
|
93
|
-
peer: await
|
|
85
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
94
86
|
approved: true,
|
|
95
87
|
link: params?.inviteLink,
|
|
96
88
|
});
|
|
97
89
|
}
|
|
98
90
|
async declineJoinRequests(chatId, params) {
|
|
99
|
-
|
|
100
|
-
await
|
|
91
|
+
this.#c.storage.assertUser("declineJoinRequests");
|
|
92
|
+
await this.#c.invoke({
|
|
101
93
|
_: "messages.hideAllChatJoinRequests",
|
|
102
|
-
peer: await
|
|
94
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
103
95
|
link: params?.inviteLink,
|
|
104
96
|
});
|
|
105
97
|
}
|
|
106
98
|
async getJoinRequests(chatId, params) {
|
|
107
|
-
|
|
99
|
+
this.#c.storage.assertUser("getJoinRequests");
|
|
108
100
|
if (typeof params?.inviteLink === "string" && typeof params?.search === "string") {
|
|
109
101
|
throw new _0_errors_js_1.InputError("inviteLink and search cannot be specified together.");
|
|
110
102
|
}
|
|
111
|
-
const peer = await
|
|
112
|
-
const offset_user = params?.fromUserId ? await
|
|
113
|
-
const { importers } = await
|
|
103
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
104
|
+
const offset_user = params?.fromUserId ? await this.#c.getInputUser(params.fromUserId) : { _: "inputUserEmpty" };
|
|
105
|
+
const { importers } = await this.#c.invoke({
|
|
114
106
|
_: "messages.getChatInviteImporters",
|
|
115
107
|
requested: true,
|
|
116
108
|
peer,
|
|
@@ -121,48 +113,48 @@ class ChatManager {
|
|
|
121
113
|
limit: (0, _0_utilities_js_1.getLimit)(params?.limit),
|
|
122
114
|
});
|
|
123
115
|
const peer_ = (0, _2_telegram_js_1.inputPeerToPeer)(peer);
|
|
124
|
-
return await Promise.all(importers.map((v) => (0, _3_types_js_1.constructJoinRequest2)(peer_, v,
|
|
116
|
+
return await Promise.all(importers.map((v) => (0, _3_types_js_1.constructJoinRequest2)(peer_, v, this.#c.getPeer)));
|
|
125
117
|
}
|
|
126
118
|
// INVITE LINKS //
|
|
127
119
|
async createInviteLink(chatId, params) {
|
|
128
120
|
if (params?.isApprovalRequired && params?.limit) {
|
|
129
121
|
throw new _0_errors_js_1.InputError("isApprovalRequired cannot be true while limit is specified.");
|
|
130
122
|
}
|
|
131
|
-
const result = await
|
|
132
|
-
return (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result),
|
|
123
|
+
const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.isApprovalRequired ? true : undefined, usage_limit: params?.limit });
|
|
124
|
+
return (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result), this.#c.getPeer);
|
|
133
125
|
}
|
|
134
126
|
async getCreatedInviteLinks(chatId, params) {
|
|
135
|
-
|
|
136
|
-
const { invites } = await
|
|
137
|
-
return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v,
|
|
127
|
+
this.#c.storage.assertUser("getCreatedInviteLinks");
|
|
128
|
+
const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.isRevoked ? true : undefined, admin_id: params?.by ? await this.#c.getInputUser(params.by) : { _: "inputUserEmpty" }, limit: (0, _0_utilities_js_1.getLimit)(params?.limit), offset_date: params?.afterDate, offset_link: params?.afterInviteLink });
|
|
129
|
+
return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v, this.#c.getPeer)));
|
|
138
130
|
}
|
|
139
131
|
// JOINING AND LEAVING CHATS //
|
|
140
132
|
async joinChat(chatId) {
|
|
141
|
-
|
|
142
|
-
const peer = await
|
|
133
|
+
this.#c.storage.assertUser("joinChat");
|
|
134
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
143
135
|
if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
144
136
|
throw new _0_errors_js_1.InputError("Cannot join private chats.");
|
|
145
137
|
}
|
|
146
138
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
147
|
-
await
|
|
139
|
+
await this.#c.invoke({ _: "channels.joinChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
|
|
148
140
|
}
|
|
149
141
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
150
|
-
await
|
|
142
|
+
await this.#c.invoke({ _: "messages.addChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" }, fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
|
|
151
143
|
}
|
|
152
144
|
else {
|
|
153
145
|
(0, _0_deps_js_1.unreachable)();
|
|
154
146
|
}
|
|
155
147
|
}
|
|
156
148
|
async leaveChat(chatId) {
|
|
157
|
-
const peer = await
|
|
149
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
158
150
|
if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
159
151
|
throw new _0_errors_js_1.InputError("Cannot leave private chats.");
|
|
160
152
|
}
|
|
161
153
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
162
|
-
await
|
|
154
|
+
await this.#c.invoke({ _: "channels.leaveChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
|
|
163
155
|
}
|
|
164
156
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
165
|
-
await
|
|
157
|
+
await this.#c.invoke({ _: "messages.deleteChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" } }); // TODO: use potential high-level method for adding participants to chats
|
|
166
158
|
}
|
|
167
159
|
else {
|
|
168
160
|
(0, _0_deps_js_1.unreachable)();
|
|
@@ -170,21 +162,21 @@ class ChatManager {
|
|
|
170
162
|
}
|
|
171
163
|
// CHAT MEMBERS //
|
|
172
164
|
async banChatMember(chatId, memberId, params) {
|
|
173
|
-
const chat = await
|
|
165
|
+
const chat = await this.#c.getInputPeer(chatId);
|
|
174
166
|
if (!(_2_tl_js_1.Api.is("inputPeerChannel", chat)) && !(_2_tl_js_1.Api.is("inputPeerChat", chat))) {
|
|
175
167
|
throw new _0_errors_js_1.InputError("Expected a channel, supergroup, or group ID.");
|
|
176
168
|
}
|
|
177
|
-
const member = await
|
|
169
|
+
const member = await this.#c.getInputPeer(memberId);
|
|
178
170
|
if (_2_tl_js_1.Api.is("inputPeerChannel", chat)) {
|
|
179
171
|
if (params?.deleteMessages) {
|
|
180
172
|
try {
|
|
181
|
-
await
|
|
173
|
+
await this.#c.messageManager.deleteChatMemberMessages(chatId, memberId);
|
|
182
174
|
}
|
|
183
175
|
catch {
|
|
184
176
|
//
|
|
185
177
|
}
|
|
186
178
|
}
|
|
187
|
-
await
|
|
179
|
+
await this.#c.invoke({
|
|
188
180
|
_: "channels.editBanned",
|
|
189
181
|
channel: { ...chat, _: "inputChannel" },
|
|
190
182
|
participant: member,
|
|
@@ -206,25 +198,25 @@ class ChatManager {
|
|
|
206
198
|
if (!(0, _0_utilities_js_1.canBeInputUser)(member)) {
|
|
207
199
|
throw new _0_errors_js_1.InputError(`Invalid user ID: ${memberId}`);
|
|
208
200
|
}
|
|
209
|
-
await
|
|
201
|
+
await this.#c.invoke({ _: "messages.deleteChatUser", chat_id: chat.chat_id, user_id: (0, _0_utilities_js_1.toInputUser)(member), revoke_history: params?.deleteMessages ? true : undefined });
|
|
210
202
|
}
|
|
211
203
|
}
|
|
212
204
|
async unbanChatMember(chatId, memberId) {
|
|
213
|
-
const channel = await
|
|
214
|
-
const member = await
|
|
215
|
-
await
|
|
205
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
206
|
+
const member = await this.#c.getInputPeer(memberId);
|
|
207
|
+
await this.#c.invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: { _: "chatBannedRights", until_date: 0 } });
|
|
216
208
|
}
|
|
217
209
|
async setChatMemberRights(chatId, memberId, params) {
|
|
218
|
-
const channel = await
|
|
219
|
-
const member = await
|
|
220
|
-
await
|
|
210
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
211
|
+
const member = await this.#c.getInputPeer(memberId);
|
|
212
|
+
await this.#c.invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: (0, _3_types_js_2.chatMemberRightsToTlObject)(params?.rights, params?.until) });
|
|
221
213
|
}
|
|
222
214
|
async promoteChatMember(chatId, userId, params) {
|
|
223
|
-
const channel = await
|
|
224
|
-
const user_id = await
|
|
215
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
216
|
+
const user_id = await this.#c.getInputUser(userId);
|
|
225
217
|
const admin_rights = (0, _3_types_js_1.chatAdministratorRightsToTlObject)(params ?? {});
|
|
226
218
|
const rank = params?.title ?? "";
|
|
227
|
-
await
|
|
219
|
+
await this.#c.invoke({
|
|
228
220
|
_: "channels.editAdmin",
|
|
229
221
|
channel,
|
|
230
222
|
user_id,
|
|
@@ -233,117 +225,138 @@ class ChatManager {
|
|
|
233
225
|
});
|
|
234
226
|
}
|
|
235
227
|
async setChatMemberTag(chatId, userId, params) {
|
|
236
|
-
const peer = await
|
|
237
|
-
const participant = await
|
|
228
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
229
|
+
const participant = await this.#c.getInputPeer(userId);
|
|
238
230
|
const rank = params?.tag ?? "";
|
|
239
|
-
await
|
|
231
|
+
await this.#c.invoke({ _: "messages.editChatParticipantRank", peer, participant, rank });
|
|
240
232
|
}
|
|
241
233
|
// CHAT SETTINGS //
|
|
242
234
|
async setAvailableReactions(chatId, availableReactions) {
|
|
243
|
-
await
|
|
235
|
+
await this.#c.invoke({ _: "messages.setChatAvailableReactions", peer: await this.#c.getInputPeer(chatId), available_reactions: availableReactions === "none" ? { _: "chatReactionsNone" } : availableReactions === "all" ? { _: "chatReactionsAll" } : Array.isArray(availableReactions) ? ({ _: "chatReactionsSome", reactions: availableReactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)) }) : (0, _0_deps_js_1.unreachable)() });
|
|
244
236
|
}
|
|
245
237
|
async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
|
|
246
|
-
|
|
247
|
-
const channel = await
|
|
248
|
-
await
|
|
238
|
+
this.#c.storage.assertUser("setBoostsRequiredToCircumventRestrictions");
|
|
239
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
240
|
+
await this.#c.invoke({ _: "channels.setBoostsToUnblockRestrictions", channel, boosts });
|
|
249
241
|
}
|
|
250
242
|
async enableJoinRequests(chatId) {
|
|
251
|
-
|
|
252
|
-
await
|
|
243
|
+
this.#c.storage.assertUser("enableJoinRequests");
|
|
244
|
+
await this.#toggleJoinRequests(chatId, true);
|
|
253
245
|
}
|
|
254
246
|
async disableJoinRequests(chatId) {
|
|
255
|
-
|
|
256
|
-
await
|
|
247
|
+
this.#c.storage.assertUser("disableJoinRequests");
|
|
248
|
+
await this.#toggleJoinRequests(chatId, false);
|
|
257
249
|
}
|
|
258
250
|
async setChatStickerSet(chatId, setName) {
|
|
259
|
-
const channel = await
|
|
260
|
-
await
|
|
251
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
252
|
+
await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
|
|
261
253
|
}
|
|
262
254
|
async deleteChatStickerSet(chatId) {
|
|
263
|
-
const channel = await
|
|
264
|
-
await
|
|
255
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
256
|
+
await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
|
|
257
|
+
}
|
|
258
|
+
async #toggleSlowMode(chatId, seconds) {
|
|
259
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
260
|
+
await this.#c.invoke({ _: "channels.toggleSlowMode", channel, seconds });
|
|
265
261
|
}
|
|
266
262
|
async disableSlowMode(chatId) {
|
|
267
|
-
|
|
268
|
-
await
|
|
263
|
+
this.#c.storage.assertUser("disableSlowMode");
|
|
264
|
+
await this.#toggleSlowMode(chatId, 0);
|
|
269
265
|
}
|
|
270
266
|
async setSlowMode(chatId, duration) {
|
|
271
|
-
|
|
267
|
+
this.#c.storage.assertUser("setSlowMode");
|
|
272
268
|
const seconds = (0, _3_types_js_1.slowModeDurationToSeconds)(duration);
|
|
273
269
|
if (seconds > 1) {
|
|
274
270
|
throw new _0_errors_js_1.InputError("Invalid slow mode duration.");
|
|
275
271
|
}
|
|
276
|
-
await
|
|
272
|
+
await this.#toggleSlowMode(chatId, seconds);
|
|
277
273
|
}
|
|
278
274
|
async setChatTitle(chatId, title) {
|
|
279
|
-
const peer = await
|
|
275
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
280
276
|
if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
281
|
-
await
|
|
277
|
+
await this.#c.invoke({ _: "messages.editChatTitle", chat_id: peer.chat_id, title });
|
|
282
278
|
}
|
|
283
279
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
284
280
|
const channel = (0, _0_utilities_js_1.toInputChannel)(peer);
|
|
285
|
-
await
|
|
281
|
+
await this.#c.invoke({ _: "channels.editTitle", channel, title });
|
|
286
282
|
}
|
|
287
283
|
else {
|
|
288
284
|
throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
|
|
289
285
|
}
|
|
290
286
|
}
|
|
291
287
|
async setChatDescription(chatId, description) {
|
|
292
|
-
const peer = await
|
|
288
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
293
289
|
if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
|
|
294
290
|
throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
|
|
295
291
|
}
|
|
296
|
-
await
|
|
292
|
+
await this.#c.invoke({ _: "messages.editChatAbout", peer, about: description });
|
|
293
|
+
}
|
|
294
|
+
async #setIsMemberListVisible(chatId, isVisible) {
|
|
295
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
296
|
+
const enabled = !isVisible;
|
|
297
|
+
await this.#c.invoke({ _: "channels.toggleParticipantsHidden", channel, enabled });
|
|
297
298
|
}
|
|
298
299
|
async hideMemberList(chatId) {
|
|
299
|
-
|
|
300
|
-
await
|
|
300
|
+
this.#c.storage.assertUser("hideMemberList");
|
|
301
|
+
await this.#setIsMemberListVisible(chatId, false);
|
|
301
302
|
}
|
|
302
303
|
async showMemberList(chatId) {
|
|
303
|
-
|
|
304
|
-
await
|
|
304
|
+
this.#c.storage.assertUser("showMemberList");
|
|
305
|
+
await this.#setIsMemberListVisible(chatId, true);
|
|
306
|
+
}
|
|
307
|
+
async #setIsTopicsEnabled(chatId, isEnabled, isShownAsTabs) {
|
|
308
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
309
|
+
await this.#c.invoke({ _: "channels.toggleForum", channel, enabled: isEnabled, tabs: isShownAsTabs });
|
|
305
310
|
}
|
|
306
311
|
async disableTopics(chatId) {
|
|
307
|
-
|
|
308
|
-
await
|
|
312
|
+
this.#c.storage.assertUser("disableTopics");
|
|
313
|
+
await this.#setIsTopicsEnabled(chatId, false, false);
|
|
309
314
|
}
|
|
310
315
|
async enableTopics(chatId, isShownAsTabs) {
|
|
311
|
-
|
|
312
|
-
await
|
|
316
|
+
this.#c.storage.assertUser("enableTopics");
|
|
317
|
+
await this.#setIsTopicsEnabled(chatId, true, isShownAsTabs);
|
|
318
|
+
}
|
|
319
|
+
async #setIsAntispamEnabled(chatId, isEnabled) {
|
|
320
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
321
|
+
await this.#c.invoke({ _: "channels.toggleAntiSpam", channel, enabled: isEnabled });
|
|
313
322
|
}
|
|
314
323
|
async enableAntispam(chatId) {
|
|
315
|
-
|
|
316
|
-
await
|
|
324
|
+
this.#c.storage.assertUser("enableAntispam");
|
|
325
|
+
await this.#setIsAntispamEnabled(chatId, true);
|
|
317
326
|
}
|
|
318
327
|
async disableAntispam(chatId) {
|
|
319
|
-
|
|
320
|
-
await
|
|
328
|
+
this.#c.storage.assertUser("disableAntispam");
|
|
329
|
+
await this.#setIsAntispamEnabled(chatId, false);
|
|
330
|
+
}
|
|
331
|
+
async #setIsSignaturesEnabled(chatId, isEnabled, params) {
|
|
332
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
333
|
+
await this.#c.invoke({ _: "channels.toggleSignatures", channel, signatures_enabled: isEnabled ? true : undefined, profiles_enabled: params?.showAuthorProfile ? true : undefined });
|
|
321
334
|
}
|
|
322
335
|
async enableSignatures(chatId, params) {
|
|
323
|
-
|
|
324
|
-
await
|
|
336
|
+
this.#c.storage.assertUser("enableSignatures");
|
|
337
|
+
await this.#setIsSignaturesEnabled(chatId, true, params);
|
|
325
338
|
}
|
|
326
339
|
async disableSignatures(chatId) {
|
|
327
|
-
|
|
328
|
-
await
|
|
340
|
+
this.#c.storage.assertUser("disableSignatures");
|
|
341
|
+
await this.#setIsSignaturesEnabled(chatId, false);
|
|
329
342
|
}
|
|
330
343
|
async deleteChat(chatId) {
|
|
331
|
-
|
|
332
|
-
const peer = await
|
|
344
|
+
this.#c.storage.assertUser("deleteChat");
|
|
345
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
333
346
|
if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
334
|
-
await
|
|
347
|
+
await this.#c.invoke({ _: "messages.deleteChat", chat_id: peer.chat_id });
|
|
335
348
|
}
|
|
336
349
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
337
350
|
const channel = (0, _0_utilities_js_1.toInputChannel)(peer);
|
|
338
|
-
await
|
|
351
|
+
await this.#c.invoke({ _: "channels.deleteChannel", channel });
|
|
339
352
|
}
|
|
340
353
|
else {
|
|
341
354
|
throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
|
|
342
355
|
}
|
|
343
356
|
}
|
|
344
357
|
async getDiscussionChatSuggestions() {
|
|
345
|
-
|
|
346
|
-
const { chats } = await
|
|
358
|
+
this.#c.storage.assertUser("getDiscussionChatSuggestions");
|
|
359
|
+
const { chats } = await this.#c.invoke({ _: "channels.getGroupsForDiscussion" });
|
|
347
360
|
return chats
|
|
348
361
|
.map((v) => {
|
|
349
362
|
if (!_2_tl_js_1.Api.isOneOf(["chat", "channel"], v)) {
|
|
@@ -356,135 +369,114 @@ class ChatManager {
|
|
|
356
369
|
.filter((v) => v !== null);
|
|
357
370
|
}
|
|
358
371
|
async setDiscussionChat(chatId, discussionChatId) {
|
|
359
|
-
|
|
360
|
-
const [broadcast, group] = await Promise.all([
|
|
361
|
-
await
|
|
372
|
+
this.#c.storage.assertUser("setDiscussionChat");
|
|
373
|
+
const [broadcast, group] = await Promise.all([this.#c.getInputChannel(chatId), this.#c.getInputChannel(discussionChatId)]);
|
|
374
|
+
await this.#c.invoke({ _: "channels.setDiscussionGroup", broadcast, group });
|
|
362
375
|
}
|
|
363
376
|
async transferChatOwnership(chatId, userId, password) {
|
|
364
|
-
|
|
365
|
-
const user_id = await
|
|
377
|
+
this.#c.storage.assertUser("transferChat");
|
|
378
|
+
const user_id = await this.#c.getInputUser(userId);
|
|
366
379
|
const isSelf = _2_tl_js_1.Api.is("inputUserSelf", user_id);
|
|
367
|
-
if (isSelf || _2_tl_js_1.Api.peerToChatId(user_id) === await
|
|
380
|
+
if (isSelf || _2_tl_js_1.Api.peerToChatId(user_id) === await this.#c.getSelfId()) {
|
|
368
381
|
throw new _0_errors_js_1.InputError("A user ID except that of the current one was expected.");
|
|
369
382
|
}
|
|
370
|
-
const peer = await
|
|
371
|
-
const ap = await
|
|
383
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
384
|
+
const ap = await this.#c.invoke({ _: "account.getPassword" });
|
|
372
385
|
const password_ = await (0, _0_password_js_1.checkPassword)(password, ap);
|
|
373
|
-
await
|
|
386
|
+
await this.#c.invoke({ _: "messages.editChatCreator", peer, user_id, password: password_ });
|
|
387
|
+
}
|
|
388
|
+
async #setIsSharingEnabled(chatId, isSharingEnabled) {
|
|
389
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
390
|
+
await this.#c.invoke({ _: "messages.toggleNoForwards", peer, enabled: !isSharingEnabled });
|
|
374
391
|
}
|
|
375
392
|
async enableSharing(chatId) {
|
|
376
|
-
|
|
377
|
-
await
|
|
393
|
+
this.#c.storage.assertUser("enableSharing");
|
|
394
|
+
await this.#setIsSharingEnabled(chatId, true);
|
|
378
395
|
}
|
|
379
396
|
async disableSharing(chatId) {
|
|
380
|
-
|
|
381
|
-
await
|
|
397
|
+
this.#c.storage.assertUser("disableSharing");
|
|
398
|
+
await this.#setIsSharingEnabled(chatId, false);
|
|
382
399
|
}
|
|
383
400
|
// CHAT PHOTOS //
|
|
384
401
|
async deleteChatPhoto(chatId) {
|
|
385
|
-
const peer = await
|
|
402
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
386
403
|
if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !(_2_tl_js_1.Api.is("inputPeerChat", peer))) {
|
|
387
404
|
(0, _0_deps_js_1.unreachable)();
|
|
388
405
|
}
|
|
389
406
|
if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
390
|
-
await
|
|
407
|
+
await this.#c.invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: { _: "inputChatPhotoEmpty" } });
|
|
391
408
|
}
|
|
392
409
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
393
|
-
await
|
|
410
|
+
await this.#c.invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: { _: "inputChatPhotoEmpty" } });
|
|
394
411
|
}
|
|
395
412
|
}
|
|
396
413
|
async setChatPhoto(chatId, photo, params) {
|
|
397
|
-
const peer = await
|
|
414
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
398
415
|
if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !(_2_tl_js_1.Api.is("inputPeerChat", peer))) {
|
|
399
416
|
(0, _0_deps_js_1.unreachable)();
|
|
400
417
|
}
|
|
401
|
-
const file = await
|
|
418
|
+
const file = await this.#c.fileManager.upload(photo, params);
|
|
402
419
|
const photo_ = { _: "inputChatUploadedPhoto", file };
|
|
403
420
|
if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
|
|
404
|
-
await
|
|
421
|
+
await this.#c.invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: photo_ });
|
|
405
422
|
}
|
|
406
423
|
else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
|
|
407
|
-
await
|
|
424
|
+
await this.#c.invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: photo_ });
|
|
408
425
|
}
|
|
409
426
|
}
|
|
410
427
|
// INVITING MEMBERS //
|
|
411
428
|
async addChatMember(chatId, userId, params) {
|
|
412
|
-
|
|
413
|
-
const chat = await
|
|
429
|
+
this.#c.storage.assertUser("addChatMember");
|
|
430
|
+
const chat = await this.#c.getInputPeer(chatId);
|
|
414
431
|
if (_2_tl_js_1.Api.isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
|
|
415
432
|
throw new _0_errors_js_1.InputError("Cannot add members to private chats");
|
|
416
433
|
}
|
|
417
|
-
const user = await
|
|
434
|
+
const user = await this.#c.getInputUser(userId);
|
|
418
435
|
if (_2_tl_js_1.Api.is("inputPeerChat", chat)) {
|
|
419
|
-
const result = await
|
|
436
|
+
const result = await this.#c.invoke({ _: "messages.addChatUser", chat_id: chat.chat_id, user_id: user, fwd_limit: params?.historyLimit ?? 0 });
|
|
420
437
|
return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
|
|
421
438
|
}
|
|
422
439
|
else if (_2_tl_js_1.Api.is("inputPeerChannel", chat)) {
|
|
423
|
-
const result = await
|
|
440
|
+
const result = await this.#c.invoke({ _: "channels.inviteToChannel", channel: { ...chat, _: "inputChannel" }, users: [user] });
|
|
424
441
|
return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
|
|
425
442
|
}
|
|
426
443
|
(0, _0_deps_js_1.unreachable)();
|
|
427
444
|
}
|
|
428
445
|
async addChatMembers(chatId, userIds) {
|
|
429
|
-
|
|
430
|
-
const chat = await
|
|
446
|
+
this.#c.storage.assertUser("addChatMembers");
|
|
447
|
+
const chat = await this.#c.getInputPeer(chatId);
|
|
431
448
|
if (_2_tl_js_1.Api.isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
|
|
432
449
|
throw new _0_errors_js_1.InputError("Cannot add members to private chats");
|
|
433
450
|
}
|
|
434
451
|
const users = new Array();
|
|
435
452
|
for (const userId of userIds) {
|
|
436
|
-
users.push(await
|
|
453
|
+
users.push(await this.#c.getInputUser(userId));
|
|
437
454
|
}
|
|
438
455
|
if (_2_tl_js_1.Api.is("inputPeerChat", chat)) {
|
|
439
456
|
throw new _0_errors_js_1.InputError("addChatMembers cannot be used with basic groups");
|
|
440
457
|
}
|
|
441
458
|
else if ((0, _0_utilities_js_1.canBeInputChannel)(chat)) {
|
|
442
|
-
const result = await
|
|
459
|
+
const result = await this.#c.invoke({ _: "channels.inviteToChannel", channel: (0, _0_utilities_js_1.toInputChannel)(chat), users });
|
|
443
460
|
return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
|
|
444
461
|
}
|
|
445
462
|
(0, _0_deps_js_1.unreachable)();
|
|
446
463
|
}
|
|
447
464
|
async getRecommendedChannels() {
|
|
448
|
-
|
|
449
|
-
const result = await
|
|
465
|
+
this.#c.storage.assertUser("getRecommendedChannels");
|
|
466
|
+
const result = await this.#c.invoke({ _: "channels.getChannelRecommendations" });
|
|
450
467
|
return result.chats.map((v) => (0, _3_types_js_1.constructChatP)(v)).filter((v) => v.type === "channel");
|
|
451
468
|
}
|
|
452
469
|
async getSimilarChannels(chatId) {
|
|
453
|
-
|
|
454
|
-
const channel = await
|
|
455
|
-
const result = await
|
|
470
|
+
this.#c.storage.assertUser("getSimilarChannels");
|
|
471
|
+
const channel = await this.#c.getInputChannel(chatId);
|
|
472
|
+
const result = await this.#c.invoke({ _: "channels.getChannelRecommendations", channel });
|
|
456
473
|
return result.chats.map((v) => (0, _3_types_js_1.constructChatP)(v)).filter((v) => v.type === "channel");
|
|
457
474
|
}
|
|
458
475
|
async getSimilarBots(chatId) {
|
|
459
|
-
|
|
460
|
-
const bot = await
|
|
461
|
-
const result = await
|
|
476
|
+
this.#c.storage.assertUser("getSimilarBots");
|
|
477
|
+
const bot = await this.#c.getInputUser(chatId);
|
|
478
|
+
const result = await this.#c.invoke({ _: "bots.getBotRecommendations", bot });
|
|
462
479
|
return result.users.map((v) => (0, _3_types_js_1.constructChatP)(v)).filter((v) => v.type === "private");
|
|
463
480
|
}
|
|
464
481
|
}
|
|
465
482
|
exports.ChatManager = ChatManager;
|
|
466
|
-
_ChatManager_c = new WeakMap(), _ChatManager_instances = new WeakSet(), _ChatManager_toggleJoinRequests =
|
|
467
|
-
// JOIN REQUESTS //
|
|
468
|
-
async function _ChatManager_toggleJoinRequests(chatId, isEnabled) {
|
|
469
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
470
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleJoinRequest", channel, enabled: isEnabled });
|
|
471
|
-
}, _ChatManager_toggleSlowMode = async function _ChatManager_toggleSlowMode(chatId, seconds) {
|
|
472
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
473
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleSlowMode", channel, seconds });
|
|
474
|
-
}, _ChatManager_setIsMemberListVisible = async function _ChatManager_setIsMemberListVisible(chatId, isVisible) {
|
|
475
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
476
|
-
const enabled = !isVisible;
|
|
477
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleParticipantsHidden", channel, enabled });
|
|
478
|
-
}, _ChatManager_setIsTopicsEnabled = async function _ChatManager_setIsTopicsEnabled(chatId, isEnabled, isShownAsTabs) {
|
|
479
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
480
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleForum", channel, enabled: isEnabled, tabs: isShownAsTabs });
|
|
481
|
-
}, _ChatManager_setIsAntispamEnabled = async function _ChatManager_setIsAntispamEnabled(chatId, isEnabled) {
|
|
482
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
483
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleAntiSpam", channel, enabled: isEnabled });
|
|
484
|
-
}, _ChatManager_setIsSignaturesEnabled = async function _ChatManager_setIsSignaturesEnabled(chatId, isEnabled, params) {
|
|
485
|
-
const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
|
|
486
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleSignatures", channel, signatures_enabled: isEnabled ? true : undefined, profiles_enabled: params?.showAuthorProfile ? true : undefined });
|
|
487
|
-
}, _ChatManager_setIsSharingEnabled = async function _ChatManager_setIsSharingEnabled(chatId, isSharingEnabled) {
|
|
488
|
-
const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
|
|
489
|
-
await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.toggleNoForwards", peer, enabled: !isSharingEnabled });
|
|
490
|
-
};
|