@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 _Context_instances, _Context_client, _Context_me, _Context_update, _Context_mustGetMsg, _Context_mustGetChatId, _Context_mustGetUserId, _Context_mustGetInlineMsgId, _Context_getReplyTo;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.Context = void 0;
|
|
35
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -156,41 +144,23 @@ const staticHas = {
|
|
|
156
144
|
* It wraps the {@link Update} type with shortcuts and method aliases.
|
|
157
145
|
*/
|
|
158
146
|
class Context {
|
|
147
|
+
#client;
|
|
148
|
+
#me;
|
|
149
|
+
#update;
|
|
159
150
|
constructor(client, me, update) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
_Context_update.set(this, void 0);
|
|
164
|
-
_Context_getReplyTo.set(this, (isQuoted, chatId, messageId) => {
|
|
165
|
-
if ("story" in this.update) {
|
|
166
|
-
return { replyTo: { chatId: this.update.story.chat.id, storyId: this.update.story.id } };
|
|
167
|
-
}
|
|
168
|
-
let messageThreadId = undefined;
|
|
169
|
-
if ("message" in this.update) {
|
|
170
|
-
messageThreadId = this.update.message.threadId;
|
|
171
|
-
}
|
|
172
|
-
else if ("editedMessage" in this.update) {
|
|
173
|
-
messageThreadId = this.update.editedMessage.threadId;
|
|
174
|
-
}
|
|
175
|
-
else if ("scheduledMessage" in this.update) {
|
|
176
|
-
messageThreadId = this.update.scheduledMessage.threadId;
|
|
177
|
-
}
|
|
178
|
-
const isPrivate = chatId > 0;
|
|
179
|
-
const shouldQuote = isQuoted === undefined ? !isPrivate : isQuoted;
|
|
180
|
-
return { messageThreadId, replyTo: shouldQuote ? { messageId } : undefined };
|
|
181
|
-
});
|
|
182
|
-
__classPrivateFieldSet(this, _Context_client, client, "f");
|
|
183
|
-
__classPrivateFieldSet(this, _Context_me, me, "f");
|
|
184
|
-
__classPrivateFieldSet(this, _Context_update, update, "f");
|
|
151
|
+
this.#client = client;
|
|
152
|
+
this.#me = me;
|
|
153
|
+
this.#update = update;
|
|
185
154
|
}
|
|
155
|
+
static has = staticHas;
|
|
186
156
|
get update() {
|
|
187
|
-
return
|
|
157
|
+
return this.#update;
|
|
188
158
|
}
|
|
189
159
|
get me() {
|
|
190
|
-
return
|
|
160
|
+
return this.#me;
|
|
191
161
|
}
|
|
192
162
|
get client() {
|
|
193
|
-
return
|
|
163
|
+
return this.#client;
|
|
194
164
|
}
|
|
195
165
|
get msg() {
|
|
196
166
|
return "message" in this.update ? this.update.message : "editedMessage" in this.update ? this.update.editedMessage : "scheduledMessage" in this.update ? this.update.scheduledMessage : "callbackQuery" in this.update ? this.update.callbackQuery.message : undefined;
|
|
@@ -210,6 +180,71 @@ class Context {
|
|
|
210
180
|
get chosenInlineResult() {
|
|
211
181
|
return "chosenInlineResult" in this.update ? this.update.chosenInlineResult : undefined;
|
|
212
182
|
}
|
|
183
|
+
#mustGetMsg() {
|
|
184
|
+
if (this.msg !== undefined) {
|
|
185
|
+
return { chatId: this.msg.chat.id, messageId: this.msg.id, businessConnectionId: this.msg.businessConnectionId, senderId: this.msg.from?.id, userId: this.msg.from?.id };
|
|
186
|
+
}
|
|
187
|
+
const reactions = "messageInteractions" in this.update ? this.update.messageInteractions : undefined;
|
|
188
|
+
if (reactions !== undefined) {
|
|
189
|
+
return { chatId: reactions.chatId, messageId: reactions.messageId };
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
(0, _0_deps_js_1.unreachable)();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
#mustGetChatId() {
|
|
196
|
+
if (this.chat) {
|
|
197
|
+
return this.chat.id;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
(0, _0_deps_js_1.unreachable)();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
#mustGetUserId() {
|
|
204
|
+
if (this.msg?.from) {
|
|
205
|
+
return this.msg.from.id;
|
|
206
|
+
}
|
|
207
|
+
else if ("callbackQuery" in this.update) {
|
|
208
|
+
return this.update.callbackQuery.from.id;
|
|
209
|
+
}
|
|
210
|
+
else if ("chosenInlineResult" in this.update) {
|
|
211
|
+
return this.update.chosenInlineResult.from.id;
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
(0, _0_deps_js_1.unreachable)();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
#mustGetInlineMsgId() {
|
|
218
|
+
if ("chosenInlineResult" in this.update) {
|
|
219
|
+
if (this.update.chosenInlineResult.inlineMessageId) {
|
|
220
|
+
return this.update.chosenInlineResult.inlineMessageId;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if ("callbackQuery" in this.update) {
|
|
224
|
+
if (this.update.callbackQuery.inlineMessageId) {
|
|
225
|
+
return this.update.callbackQuery.inlineMessageId;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
(0, _0_deps_js_1.unreachable)();
|
|
229
|
+
}
|
|
230
|
+
#getReplyTo = (isQuoted, chatId, messageId) => {
|
|
231
|
+
if ("story" in this.update) {
|
|
232
|
+
return { replyTo: { chatId: this.update.story.chat.id, storyId: this.update.story.id } };
|
|
233
|
+
}
|
|
234
|
+
let messageThreadId = undefined;
|
|
235
|
+
if ("message" in this.update) {
|
|
236
|
+
messageThreadId = this.update.message.threadId;
|
|
237
|
+
}
|
|
238
|
+
else if ("editedMessage" in this.update) {
|
|
239
|
+
messageThreadId = this.update.editedMessage.threadId;
|
|
240
|
+
}
|
|
241
|
+
else if ("scheduledMessage" in this.update) {
|
|
242
|
+
messageThreadId = this.update.scheduledMessage.threadId;
|
|
243
|
+
}
|
|
244
|
+
const isPrivate = chatId > 0;
|
|
245
|
+
const shouldQuote = isQuoted === undefined ? !isPrivate : isQuoted;
|
|
246
|
+
return { messageThreadId, replyTo: shouldQuote ? { messageId } : undefined };
|
|
247
|
+
};
|
|
213
248
|
get chat() {
|
|
214
249
|
return this.msg?.chat ?? ("messageReactions" in this.update ? this.update.messageReactions.chat : "messageReactionCount" in this.update ? this.update.messageReactionCount.chat : "chatMember" in this.update ? this.update.chatMember.chat : "myChatMember" in this.update ? this.update.myChatMember.chat : "joinRequest" in this.update ? this.update.joinRequest.chat : "story" in this.update ? this.update.story.chat : undefined);
|
|
215
250
|
}
|
|
@@ -252,49 +287,49 @@ class Context {
|
|
|
252
287
|
* Context-aware alias for {@link Client.addContact}.
|
|
253
288
|
*/
|
|
254
289
|
async addAsContact(params) {
|
|
255
|
-
const chatId =
|
|
290
|
+
const chatId = this.#mustGetChatId();
|
|
256
291
|
return await this.client.addContact(chatId, params);
|
|
257
292
|
}
|
|
258
293
|
/**
|
|
259
294
|
* Context-aware alias for {@link Client.addChatMember}.
|
|
260
295
|
*/
|
|
261
296
|
async addMember(userId, params) {
|
|
262
|
-
const chatId =
|
|
297
|
+
const chatId = this.#mustGetChatId();
|
|
263
298
|
return await this.client.addChatMember(chatId, userId, params);
|
|
264
299
|
}
|
|
265
300
|
/**
|
|
266
301
|
* Context-aware alias for {@link Client.addChatMembers}.
|
|
267
302
|
*/
|
|
268
303
|
async addMembers(userIds) {
|
|
269
|
-
const chatId =
|
|
304
|
+
const chatId = this.#mustGetChatId();
|
|
270
305
|
return await this.client.addChatMembers(chatId, userIds);
|
|
271
306
|
}
|
|
272
307
|
/**
|
|
273
308
|
* Context-aware alias for {@link Client.addReaction}.
|
|
274
309
|
*/
|
|
275
310
|
async addReaction(messageId, reaction, params) {
|
|
276
|
-
const chatId =
|
|
311
|
+
const chatId = this.#mustGetChatId();
|
|
277
312
|
return await this.client.addReaction(chatId, messageId, reaction, params);
|
|
278
313
|
}
|
|
279
314
|
/**
|
|
280
315
|
* Context-aware alias for {@link Client.addStoriesToHighlights}.
|
|
281
316
|
*/
|
|
282
317
|
async addStoriesToHighlights(storyIds) {
|
|
283
|
-
const chatId =
|
|
318
|
+
const chatId = this.#mustGetChatId();
|
|
284
319
|
return await this.client.addStoriesToHighlights(chatId, storyIds);
|
|
285
320
|
}
|
|
286
321
|
/**
|
|
287
322
|
* Context-aware alias for {@link Client.addStoryToHighlights}.
|
|
288
323
|
*/
|
|
289
324
|
async addStoryToHighlights(storyId) {
|
|
290
|
-
const chatId =
|
|
325
|
+
const chatId = this.#mustGetChatId();
|
|
291
326
|
return await this.client.addStoryToHighlights(chatId, storyId);
|
|
292
327
|
}
|
|
293
328
|
/**
|
|
294
329
|
* Context-aware alias for {@link Client.addToChecklist}.
|
|
295
330
|
*/
|
|
296
331
|
async addToChecklist(messageId, items) {
|
|
297
|
-
const chatId =
|
|
332
|
+
const chatId = this.#mustGetChatId();
|
|
298
333
|
return await this.client.addToChecklist(chatId, messageId, items);
|
|
299
334
|
}
|
|
300
335
|
/**
|
|
@@ -328,7 +363,7 @@ class Context {
|
|
|
328
363
|
* Context-aware alias for {@link Client.approveJoinRequest}.
|
|
329
364
|
*/
|
|
330
365
|
async approveJoinRequest() {
|
|
331
|
-
const { chatId, userId } =
|
|
366
|
+
const { chatId, userId } = this.#mustGetMsg();
|
|
332
367
|
if (!userId) {
|
|
333
368
|
(0, _0_deps_js_1.unreachable)();
|
|
334
369
|
}
|
|
@@ -338,28 +373,28 @@ class Context {
|
|
|
338
373
|
* Context-aware alias for {@link Client.approveJoinRequests}.
|
|
339
374
|
*/
|
|
340
375
|
async approveJoinRequests(params) {
|
|
341
|
-
const chatId =
|
|
376
|
+
const chatId = this.#mustGetChatId();
|
|
342
377
|
return await this.client.approveJoinRequests(chatId, params);
|
|
343
378
|
}
|
|
344
379
|
/**
|
|
345
380
|
* Context-aware alias for {@link Client.archiveChat}.
|
|
346
381
|
*/
|
|
347
382
|
async archive() {
|
|
348
|
-
const chatId =
|
|
383
|
+
const chatId = this.#mustGetChatId();
|
|
349
384
|
return await this.client.archiveChat(chatId);
|
|
350
385
|
}
|
|
351
386
|
/**
|
|
352
387
|
* Context-aware alias for {@link Client.banChatMember}.
|
|
353
388
|
*/
|
|
354
389
|
async banChatMember(memberId, params) {
|
|
355
|
-
const chatId =
|
|
390
|
+
const chatId = this.#mustGetChatId();
|
|
356
391
|
return await this.client.banChatMember(chatId, memberId, params);
|
|
357
392
|
}
|
|
358
393
|
/**
|
|
359
394
|
* Context-aware alias for {@link Client.banChatMember}.
|
|
360
395
|
*/
|
|
361
396
|
async banSender(params) {
|
|
362
|
-
const { chatId, senderId } =
|
|
397
|
+
const { chatId, senderId } = this.#mustGetMsg();
|
|
363
398
|
if (!senderId) {
|
|
364
399
|
(0, _0_deps_js_1.unreachable)();
|
|
365
400
|
}
|
|
@@ -369,62 +404,62 @@ class Context {
|
|
|
369
404
|
* Context-aware alias for {@link Client.blockUser}.
|
|
370
405
|
*/
|
|
371
406
|
async blockUser() {
|
|
372
|
-
return await this.client.blockUser(
|
|
407
|
+
return await this.client.blockUser(this.#mustGetUserId());
|
|
373
408
|
}
|
|
374
409
|
/**
|
|
375
410
|
* Context-aware alias for {@link Client.checkChecklistItem}.
|
|
376
411
|
*/
|
|
377
412
|
async checkChecklistItem(messageId, item) {
|
|
378
|
-
const chatId =
|
|
413
|
+
const chatId = this.#mustGetChatId();
|
|
379
414
|
return await this.client.checkChecklistItem(chatId, messageId, item);
|
|
380
415
|
}
|
|
381
416
|
/**
|
|
382
417
|
* Context-aware alias for {@link Client.checkChecklistItems}.
|
|
383
418
|
*/
|
|
384
419
|
async checkChecklistItems(messageId, items) {
|
|
385
|
-
const chatId =
|
|
420
|
+
const chatId = this.#mustGetChatId();
|
|
386
421
|
return await this.client.checkChecklistItems(chatId, messageId, items);
|
|
387
422
|
}
|
|
388
423
|
/**
|
|
389
424
|
* Context-aware alias for {@link Client.closeChat}.
|
|
390
425
|
*/
|
|
391
426
|
async close() {
|
|
392
|
-
const chatId =
|
|
427
|
+
const chatId = this.#mustGetChatId();
|
|
393
428
|
return await this.client.closeChat(chatId);
|
|
394
429
|
}
|
|
395
430
|
/**
|
|
396
431
|
* Context-aware alias for {@link Client.closeTopic}.
|
|
397
432
|
*/
|
|
398
433
|
async closeTopic(topicId) {
|
|
399
|
-
const chatId =
|
|
434
|
+
const chatId = this.#mustGetChatId();
|
|
400
435
|
return await this.client.closeTopic(chatId, topicId);
|
|
401
436
|
}
|
|
402
437
|
/**
|
|
403
438
|
* Context-aware alias for {@link Client.createInviteLink}.
|
|
404
439
|
*/
|
|
405
440
|
async createInviteLink(params) {
|
|
406
|
-
const chatId =
|
|
441
|
+
const chatId = this.#mustGetChatId();
|
|
407
442
|
return await this.client.createInviteLink(chatId, params);
|
|
408
443
|
}
|
|
409
444
|
/**
|
|
410
445
|
* Context-aware alias for {@link Client.createStory}.
|
|
411
446
|
*/
|
|
412
447
|
async createStory(content, params) {
|
|
413
|
-
const chatId =
|
|
448
|
+
const chatId = this.#mustGetChatId();
|
|
414
449
|
return await this.client.createStory(chatId, content, params);
|
|
415
450
|
}
|
|
416
451
|
/**
|
|
417
452
|
* Context-aware alias for {@link Client.createTopic}.
|
|
418
453
|
*/
|
|
419
454
|
async createTopic(title, params) {
|
|
420
|
-
const chatId =
|
|
455
|
+
const chatId = this.#mustGetChatId();
|
|
421
456
|
return await this.client.createTopic(chatId, title, params);
|
|
422
457
|
}
|
|
423
458
|
/**
|
|
424
459
|
* Context-aware alias for {@link Client.declineJoinRequest}.
|
|
425
460
|
*/
|
|
426
461
|
async declineJoinRequest() {
|
|
427
|
-
const { chatId, userId } =
|
|
462
|
+
const { chatId, userId } = this.#mustGetMsg();
|
|
428
463
|
if (!userId) {
|
|
429
464
|
(0, _0_deps_js_1.unreachable)();
|
|
430
465
|
}
|
|
@@ -434,280 +469,280 @@ class Context {
|
|
|
434
469
|
* Context-aware alias for {@link Client.declineJoinRequests}.
|
|
435
470
|
*/
|
|
436
471
|
async declineJoinRequests(params) {
|
|
437
|
-
const chatId =
|
|
472
|
+
const chatId = this.#mustGetChatId();
|
|
438
473
|
return await this.client.declineJoinRequests(chatId, params);
|
|
439
474
|
}
|
|
440
475
|
/**
|
|
441
476
|
* Context-aware alias for {@link Client.deleteChatPhoto}.
|
|
442
477
|
*/
|
|
443
478
|
async deletChatPhoto() {
|
|
444
|
-
const chatId =
|
|
479
|
+
const chatId = this.#mustGetChatId();
|
|
445
480
|
return await this.client.deleteChatPhoto(chatId);
|
|
446
481
|
}
|
|
447
482
|
/**
|
|
448
483
|
* Context-aware alias for {@link Client.deleteMessage}.
|
|
449
484
|
*/
|
|
450
485
|
async delete() {
|
|
451
|
-
const { chatId, messageId } =
|
|
486
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
452
487
|
return await this.client.deleteMessage(chatId, messageId);
|
|
453
488
|
}
|
|
454
489
|
/**
|
|
455
490
|
* Context-aware alias for {@link Client.deleteChat}.
|
|
456
491
|
*/
|
|
457
492
|
async deleteChat() {
|
|
458
|
-
const chatId =
|
|
493
|
+
const chatId = this.#mustGetChatId();
|
|
459
494
|
return await this.client.deleteChat(chatId);
|
|
460
495
|
}
|
|
461
496
|
/**
|
|
462
497
|
* Context-aware alias for {@link Client.deleteChatMemberMessages}.
|
|
463
498
|
*/
|
|
464
499
|
async deleteChatMemberMessages(userId) {
|
|
465
|
-
const chatId =
|
|
500
|
+
const chatId = this.#mustGetChatId();
|
|
466
501
|
return await this.client.deleteChatMemberMessages(chatId, userId);
|
|
467
502
|
}
|
|
468
503
|
/**
|
|
469
504
|
* Context-aware alias for {@link Client.deleteChatStickerSet}.
|
|
470
505
|
*/
|
|
471
506
|
async deleteChatStickerSet() {
|
|
472
|
-
const chatId =
|
|
507
|
+
const chatId = this.#mustGetChatId();
|
|
473
508
|
return await this.client.deleteChatStickerSet(chatId);
|
|
474
509
|
}
|
|
475
510
|
/**
|
|
476
511
|
* Context-aware alias for {@link Client.deleteMessage}.
|
|
477
512
|
*/
|
|
478
513
|
async deleteMessage(messageId, params) {
|
|
479
|
-
const chatId =
|
|
514
|
+
const chatId = this.#mustGetChatId();
|
|
480
515
|
return await this.client.deleteMessage(chatId, messageId, params);
|
|
481
516
|
}
|
|
482
517
|
/**
|
|
483
518
|
* Context-aware alias for {@link Client.deleteMessages}.
|
|
484
519
|
*/
|
|
485
520
|
async deleteMessages(messageIds, params) {
|
|
486
|
-
const chatId =
|
|
521
|
+
const chatId = this.#mustGetChatId();
|
|
487
522
|
return await this.client.deleteMessages(chatId, messageIds, params);
|
|
488
523
|
}
|
|
489
524
|
/**
|
|
490
525
|
* Context-aware alias for {@link Client.deleteScheduledMessage}.
|
|
491
526
|
*/
|
|
492
527
|
async deleteScheduledMessage(messageId) {
|
|
493
|
-
const chatId =
|
|
528
|
+
const chatId = this.#mustGetChatId();
|
|
494
529
|
return await this.client.deleteScheduledMessage(chatId, messageId);
|
|
495
530
|
}
|
|
496
531
|
/**
|
|
497
532
|
* Context-aware alias for {@link Client.deleteScheduledMessages}.
|
|
498
533
|
*/
|
|
499
534
|
async deleteScheduledMessages(messageIds) {
|
|
500
|
-
const chatId =
|
|
535
|
+
const chatId = this.#mustGetChatId();
|
|
501
536
|
return await this.client.deleteScheduledMessages(chatId, messageIds);
|
|
502
537
|
}
|
|
503
538
|
/**
|
|
504
539
|
* Context-aware alias for {@link Client.deleteStories}.
|
|
505
540
|
*/
|
|
506
541
|
async deleteStories(storyIds) {
|
|
507
|
-
const chatId =
|
|
542
|
+
const chatId = this.#mustGetChatId();
|
|
508
543
|
return await this.client.deleteStories(chatId, storyIds);
|
|
509
544
|
}
|
|
510
545
|
/**
|
|
511
546
|
* Context-aware alias for {@link Client.deleteStory}.
|
|
512
547
|
*/
|
|
513
548
|
async deleteStory(storyId) {
|
|
514
|
-
const chatId =
|
|
549
|
+
const chatId = this.#mustGetChatId();
|
|
515
550
|
return await this.client.deleteStory(chatId, storyId);
|
|
516
551
|
}
|
|
517
552
|
/**
|
|
518
553
|
* Context-aware alias for {@link Client.disableAntispam}.
|
|
519
554
|
*/
|
|
520
555
|
async disableAntispam() {
|
|
521
|
-
const chatId =
|
|
556
|
+
const chatId = this.#mustGetChatId();
|
|
522
557
|
return await this.client.disableAntispam(chatId);
|
|
523
558
|
}
|
|
524
559
|
/**
|
|
525
560
|
* Context-aware alias for {@link Client.disableBusinessBots}.
|
|
526
561
|
*/
|
|
527
562
|
async disableBusinessBots() {
|
|
528
|
-
const chatId =
|
|
563
|
+
const chatId = this.#mustGetChatId();
|
|
529
564
|
return await this.client.disableBusinessBots(chatId);
|
|
530
565
|
}
|
|
531
566
|
/**
|
|
532
567
|
* Context-aware alias for {@link Client.disableJoinRequests}.
|
|
533
568
|
*/
|
|
534
569
|
async disableJoinRequests() {
|
|
535
|
-
const chatId =
|
|
570
|
+
const chatId = this.#mustGetChatId();
|
|
536
571
|
return await this.client.disableJoinRequests(chatId);
|
|
537
572
|
}
|
|
538
573
|
/**
|
|
539
574
|
* Context-aware alias for {@link Client.disableSharing}.
|
|
540
575
|
*/
|
|
541
576
|
async disableSharing() {
|
|
542
|
-
const chatId =
|
|
577
|
+
const chatId = this.#mustGetChatId();
|
|
543
578
|
return await this.client.disableSharing(chatId);
|
|
544
579
|
}
|
|
545
580
|
/**
|
|
546
581
|
* Context-aware alias for {@link Client.disableSignatures}.
|
|
547
582
|
*/
|
|
548
583
|
async disableSignatures() {
|
|
549
|
-
const chatId =
|
|
584
|
+
const chatId = this.#mustGetChatId();
|
|
550
585
|
return await this.client.disableSignatures(chatId);
|
|
551
586
|
}
|
|
552
587
|
/**
|
|
553
588
|
* Context-aware alias for {@link Client.disableSlowMode}.
|
|
554
589
|
*/
|
|
555
590
|
async disableSlowMode() {
|
|
556
|
-
const chatId =
|
|
591
|
+
const chatId = this.#mustGetChatId();
|
|
557
592
|
return await this.client.disableSlowMode(chatId);
|
|
558
593
|
}
|
|
559
594
|
/**
|
|
560
595
|
* Context-aware alias for {@link Client.disableTopics}.
|
|
561
596
|
*/
|
|
562
597
|
async disableTopics() {
|
|
563
|
-
const chatId =
|
|
598
|
+
const chatId = this.#mustGetChatId();
|
|
564
599
|
return await this.client.disableTopics(chatId);
|
|
565
600
|
}
|
|
566
601
|
/**
|
|
567
602
|
* Context-aware alias for {@link Client.editInlineMessageCaption}.
|
|
568
603
|
*/
|
|
569
604
|
async editInlineMessageCaption(params) {
|
|
570
|
-
const inlineMessageId =
|
|
605
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
571
606
|
return await this.client.editInlineMessageCaption(inlineMessageId, params);
|
|
572
607
|
}
|
|
573
608
|
/**
|
|
574
609
|
* Context-aware alias for {@link Client.editInlineMessageLiveLocation}.
|
|
575
610
|
*/
|
|
576
611
|
async editInlineMessageLiveLocation(latitude, longitude, params) {
|
|
577
|
-
const inlineMessageId =
|
|
612
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
578
613
|
return await this.client.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
|
|
579
614
|
}
|
|
580
615
|
/**
|
|
581
616
|
* Context-aware alias for {@link Client.editInlineMessageMedia}.
|
|
582
617
|
*/
|
|
583
618
|
async editInlineMessageMedia(media, params) {
|
|
584
|
-
const inlineMessageId =
|
|
619
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
585
620
|
return await this.client.editInlineMessageMedia(inlineMessageId, media, params);
|
|
586
621
|
}
|
|
587
622
|
/**
|
|
588
623
|
* Context-aware alias for {@link Client.editInlineMessageReplyMarkup}.
|
|
589
624
|
*/
|
|
590
625
|
async editInlineMessageReplyMarkup(params) {
|
|
591
|
-
const inlineMessageId =
|
|
626
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
592
627
|
return await this.client.editInlineMessageReplyMarkup(inlineMessageId, params);
|
|
593
628
|
}
|
|
594
629
|
/**
|
|
595
630
|
* Context-aware alias for {@link Client.editInlineMessageText}.
|
|
596
631
|
*/
|
|
597
632
|
async editInlineMessageText(text, params) {
|
|
598
|
-
const inlineMessageId =
|
|
633
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
599
634
|
return await this.client.editInlineMessageText(inlineMessageId, text, params);
|
|
600
635
|
}
|
|
601
636
|
/**
|
|
602
637
|
* Context-aware alias for {@link Client.editMessageCaption}.
|
|
603
638
|
*/
|
|
604
639
|
async editMessageCaption(messageId, params) {
|
|
605
|
-
const chatId =
|
|
640
|
+
const chatId = this.#mustGetChatId();
|
|
606
641
|
return await this.client.editMessageCaption(chatId, messageId, params);
|
|
607
642
|
}
|
|
608
643
|
/**
|
|
609
644
|
* Context-aware alias for {@link Client.editMessageLiveLocation}.
|
|
610
645
|
*/
|
|
611
646
|
async editMessageLiveLocation(messageId, latitude, longitude, params) {
|
|
612
|
-
const chatId =
|
|
647
|
+
const chatId = this.#mustGetChatId();
|
|
613
648
|
return await this.client.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
|
|
614
649
|
}
|
|
615
650
|
/**
|
|
616
651
|
* Context-aware alias for {@link Client.editMessageMedia}.
|
|
617
652
|
*/
|
|
618
653
|
async editMessageMedia(messageId, media, params) {
|
|
619
|
-
const chatId =
|
|
654
|
+
const chatId = this.#mustGetChatId();
|
|
620
655
|
return await this.client.editMessageMedia(chatId, messageId, media, params);
|
|
621
656
|
}
|
|
622
657
|
/**
|
|
623
658
|
* Context-aware alias for {@link Client.editMessageReplyMarkup}.
|
|
624
659
|
*/
|
|
625
660
|
async editMessageReplyMarkup(messageId, params) {
|
|
626
|
-
const chatId =
|
|
661
|
+
const chatId = this.#mustGetChatId();
|
|
627
662
|
return await this.client.editMessageReplyMarkup(chatId, messageId, params);
|
|
628
663
|
}
|
|
629
664
|
/**
|
|
630
665
|
* Context-aware alias for {@link Client.editMessageText}.
|
|
631
666
|
*/
|
|
632
667
|
async editMessageText(messageId, text, params) {
|
|
633
|
-
const chatId =
|
|
668
|
+
const chatId = this.#mustGetChatId();
|
|
634
669
|
return await this.client.editMessageText(chatId, messageId, text, params);
|
|
635
670
|
}
|
|
636
671
|
/**
|
|
637
672
|
* Context-aware alias for {@link Client.editTopic}.
|
|
638
673
|
*/
|
|
639
674
|
async editTopic(topicId, title, params) {
|
|
640
|
-
const chatId =
|
|
675
|
+
const chatId = this.#mustGetChatId();
|
|
641
676
|
return await this.client.editTopic(chatId, topicId, title, params);
|
|
642
677
|
}
|
|
643
678
|
/**
|
|
644
679
|
* Context-aware alias for {@link Client.enableAntispam}.
|
|
645
680
|
*/
|
|
646
681
|
async enableAntispam() {
|
|
647
|
-
const chatId =
|
|
682
|
+
const chatId = this.#mustGetChatId();
|
|
648
683
|
return await this.client.enableAntispam(chatId);
|
|
649
684
|
}
|
|
650
685
|
/**
|
|
651
686
|
* Context-aware alias for {@link Client.enableBusinessBots}.
|
|
652
687
|
*/
|
|
653
688
|
async enableBusinessBots() {
|
|
654
|
-
const chatId =
|
|
689
|
+
const chatId = this.#mustGetChatId();
|
|
655
690
|
return await this.client.enableBusinessBots(chatId);
|
|
656
691
|
}
|
|
657
692
|
/**
|
|
658
693
|
* Context-aware alias for {@link Client.enableJoinRequests}.
|
|
659
694
|
*/
|
|
660
695
|
async enableJoinRequests() {
|
|
661
|
-
const chatId =
|
|
696
|
+
const chatId = this.#mustGetChatId();
|
|
662
697
|
return await this.client.enableJoinRequests(chatId);
|
|
663
698
|
}
|
|
664
699
|
/**
|
|
665
700
|
* Context-aware alias for {@link Client.enableSharing}.
|
|
666
701
|
*/
|
|
667
702
|
async enableSharing() {
|
|
668
|
-
const chatId =
|
|
703
|
+
const chatId = this.#mustGetChatId();
|
|
669
704
|
return await this.client.enableSharing(chatId);
|
|
670
705
|
}
|
|
671
706
|
/**
|
|
672
707
|
* Context-aware alias for {@link Client.enableSignatures}.
|
|
673
708
|
*/
|
|
674
709
|
async enableSignatures(params) {
|
|
675
|
-
const chatId =
|
|
710
|
+
const chatId = this.#mustGetChatId();
|
|
676
711
|
return await this.client.enableSignatures(chatId, params);
|
|
677
712
|
}
|
|
678
713
|
/**
|
|
679
714
|
* Context-aware alias for {@link Client.enableTopics}.
|
|
680
715
|
*/
|
|
681
716
|
async enableTopics(isShownAsTabs) {
|
|
682
|
-
const chatId =
|
|
717
|
+
const chatId = this.#mustGetChatId();
|
|
683
718
|
return await this.client.enableTopics(chatId, isShownAsTabs);
|
|
684
719
|
}
|
|
685
720
|
/**
|
|
686
721
|
* Context-aware alias for {@link Client.forwardMessage}.
|
|
687
722
|
*/
|
|
688
723
|
async forward(to, params) {
|
|
689
|
-
const { chatId, messageId } =
|
|
724
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
690
725
|
return await this.client.forwardMessage(chatId, to, messageId, params);
|
|
691
726
|
}
|
|
692
727
|
/**
|
|
693
728
|
* Context-aware alias for {@link Client.forwardMessage}.
|
|
694
729
|
*/
|
|
695
730
|
async forwardMessage(to, messageId, params) {
|
|
696
|
-
const chatId =
|
|
731
|
+
const chatId = this.#mustGetChatId();
|
|
697
732
|
return await this.client.forwardMessage(chatId, to, messageId, params);
|
|
698
733
|
}
|
|
699
734
|
/**
|
|
700
735
|
* Context-aware alias for {@link Client.forwardMessages}.
|
|
701
736
|
*/
|
|
702
737
|
async forwardMessages(to, messageIds, params) {
|
|
703
|
-
const chatId =
|
|
738
|
+
const chatId = this.#mustGetChatId();
|
|
704
739
|
return await this.client.forwardMessages(chatId, to, messageIds, params);
|
|
705
740
|
}
|
|
706
741
|
/**
|
|
707
742
|
* Context-aware alias for {@link Client.getBusinessConnection}.
|
|
708
743
|
*/
|
|
709
744
|
async getBusinessConnection() {
|
|
710
|
-
const { businessConnectionId } =
|
|
745
|
+
const { businessConnectionId } = this.#mustGetMsg();
|
|
711
746
|
if (!businessConnectionId) {
|
|
712
747
|
(0, _0_deps_js_1.unreachable)();
|
|
713
748
|
}
|
|
@@ -717,161 +752,161 @@ class Context {
|
|
|
717
752
|
* Context-aware alias for {@link Client.getChat}.
|
|
718
753
|
*/
|
|
719
754
|
async getChat() {
|
|
720
|
-
const chatId =
|
|
755
|
+
const chatId = this.#mustGetChatId();
|
|
721
756
|
return await this.client.getChat(chatId);
|
|
722
757
|
}
|
|
723
758
|
/**
|
|
724
759
|
* Context-aware alias for {@link Client.getChatAdministrators}.
|
|
725
760
|
*/
|
|
726
761
|
async getChatAdministrators() {
|
|
727
|
-
const chatId =
|
|
762
|
+
const chatId = this.#mustGetChatId();
|
|
728
763
|
return await this.client.getChatAdministrators(chatId);
|
|
729
764
|
}
|
|
730
765
|
/**
|
|
731
766
|
* Context-aware alias for {@link Client.getChatMember}.
|
|
732
767
|
*/
|
|
733
768
|
async getChatMember(userId) {
|
|
734
|
-
const chatId =
|
|
769
|
+
const chatId = this.#mustGetChatId();
|
|
735
770
|
return await this.client.getChatMember(chatId, userId);
|
|
736
771
|
}
|
|
737
772
|
/**
|
|
738
773
|
* Context-aware alias for {@link Client.getChatMembers}.
|
|
739
774
|
*/
|
|
740
775
|
async getChatMembers(params) {
|
|
741
|
-
const chatId =
|
|
776
|
+
const chatId = this.#mustGetChatId();
|
|
742
777
|
return await this.client.getChatMembers(chatId, params);
|
|
743
778
|
}
|
|
744
779
|
/**
|
|
745
780
|
* Context-aware alias for {@link Client.getChatSettings}.
|
|
746
781
|
*/
|
|
747
782
|
async getChatSettings() {
|
|
748
|
-
const chatId =
|
|
783
|
+
const chatId = this.#mustGetChatId();
|
|
749
784
|
return await this.client.getChatSettings(chatId);
|
|
750
785
|
}
|
|
751
786
|
/**
|
|
752
787
|
* Context-aware alias for {@link Client.getClaimedGifts}.
|
|
753
788
|
*/
|
|
754
789
|
async getClaimedGifts(params) {
|
|
755
|
-
const chatId =
|
|
790
|
+
const chatId = this.#mustGetChatId();
|
|
756
791
|
return await this.client.getClaimedGifts(chatId, params);
|
|
757
792
|
}
|
|
758
793
|
/**
|
|
759
794
|
* Context-aware alias for {@link Client.getChatSettings}.
|
|
760
795
|
*/
|
|
761
796
|
async getCommonChats() {
|
|
762
|
-
const chatId =
|
|
797
|
+
const chatId = this.#mustGetChatId();
|
|
763
798
|
return await this.client.getCommonChats(chatId);
|
|
764
799
|
}
|
|
765
800
|
/**
|
|
766
801
|
* Context-aware alias for {@link Client.getCreatedInviteLinks}.
|
|
767
802
|
*/
|
|
768
803
|
async getCreatedInviteLinks(params) {
|
|
769
|
-
const chatId =
|
|
804
|
+
const chatId = this.#mustGetChatId();
|
|
770
805
|
return await this.client.getCreatedInviteLinks(chatId, params);
|
|
771
806
|
}
|
|
772
807
|
/**
|
|
773
808
|
* Context-aware alias for {@link Client.getHistory}.
|
|
774
809
|
*/
|
|
775
810
|
async getHistory(params) {
|
|
776
|
-
const chatId =
|
|
811
|
+
const chatId = this.#mustGetChatId();
|
|
777
812
|
return await this.client.getHistory(chatId, params);
|
|
778
813
|
}
|
|
779
814
|
/**
|
|
780
815
|
* Context-aware alias for {@link Client.getJoinRequests}.
|
|
781
816
|
*/
|
|
782
817
|
async getJoinRequests(params) {
|
|
783
|
-
const chatId =
|
|
818
|
+
const chatId = this.#mustGetChatId();
|
|
784
819
|
return await this.client.getJoinRequests(chatId, params);
|
|
785
820
|
}
|
|
786
821
|
/**
|
|
787
822
|
* Context-aware alias for {@link Client.getMessage}.
|
|
788
823
|
*/
|
|
789
824
|
async getMessage(messageId) {
|
|
790
|
-
const chatId =
|
|
825
|
+
const chatId = this.#mustGetChatId();
|
|
791
826
|
return await this.client.getMessage(chatId, messageId);
|
|
792
827
|
}
|
|
793
828
|
/**
|
|
794
829
|
* Context-aware alias for {@link Client.getMessageReactions}.
|
|
795
830
|
*/
|
|
796
831
|
async getMessageReactions(messageId) {
|
|
797
|
-
const chatId =
|
|
832
|
+
const chatId = this.#mustGetChatId();
|
|
798
833
|
return await this.client.getMessageReactions(chatId, messageId);
|
|
799
834
|
}
|
|
800
835
|
/**
|
|
801
836
|
* Context-aware alias for {@link Client.getMessages}.
|
|
802
837
|
*/
|
|
803
838
|
async getMessages(messageIds) {
|
|
804
|
-
const chatId =
|
|
839
|
+
const chatId = this.#mustGetChatId();
|
|
805
840
|
return await this.client.getMessages(chatId, messageIds);
|
|
806
841
|
}
|
|
807
842
|
/**
|
|
808
843
|
* Context-aware alias for {@link Client.getSavedMessages}.
|
|
809
844
|
*/
|
|
810
845
|
async getSavedMessages(params) {
|
|
811
|
-
const chatId =
|
|
846
|
+
const chatId = this.#mustGetChatId();
|
|
812
847
|
return await this.client.getSavedMessages(chatId, params);
|
|
813
848
|
}
|
|
814
849
|
/**
|
|
815
850
|
* Context-aware alias for {@link Client.getSimilarBots}.
|
|
816
851
|
*/
|
|
817
852
|
async getSimilarBots() {
|
|
818
|
-
const chatId =
|
|
853
|
+
const chatId = this.#mustGetChatId();
|
|
819
854
|
return await this.client.getSimilarBots(chatId);
|
|
820
855
|
}
|
|
821
856
|
/**
|
|
822
857
|
* Context-aware alias for {@link Client.getSimilarChannels}.
|
|
823
858
|
*/
|
|
824
859
|
async getSimilarChannels() {
|
|
825
|
-
const chatId =
|
|
860
|
+
const chatId = this.#mustGetChatId();
|
|
826
861
|
return await this.client.getSimilarChannels(chatId);
|
|
827
862
|
}
|
|
828
863
|
/**
|
|
829
864
|
* Context-aware alias for {@link Client.getStories}.
|
|
830
865
|
*/
|
|
831
866
|
async getStories(storyIds) {
|
|
832
|
-
const chatId =
|
|
867
|
+
const chatId = this.#mustGetChatId();
|
|
833
868
|
return await this.client.getStories(chatId, storyIds);
|
|
834
869
|
}
|
|
835
870
|
/**
|
|
836
871
|
* Context-aware alias for {@link Client.getStory}.
|
|
837
872
|
*/
|
|
838
873
|
async getStory(storyId) {
|
|
839
|
-
const chatId =
|
|
874
|
+
const chatId = this.#mustGetChatId();
|
|
840
875
|
return await this.client.getStory(chatId, storyId);
|
|
841
876
|
}
|
|
842
877
|
/**
|
|
843
878
|
* Context-aware alias for {@link Client.sendGift}.
|
|
844
879
|
*/
|
|
845
880
|
async gift(giftId, params) {
|
|
846
|
-
const chatId =
|
|
881
|
+
const chatId = this.#mustGetChatId();
|
|
847
882
|
return await this.client.sendGift(chatId, giftId, params);
|
|
848
883
|
}
|
|
849
884
|
/**
|
|
850
885
|
* Context-aware alias for {@link Client.hideGeneralTopic}.
|
|
851
886
|
*/
|
|
852
887
|
async hideGeneralTopic() {
|
|
853
|
-
const chatId =
|
|
888
|
+
const chatId = this.#mustGetChatId();
|
|
854
889
|
return await this.client.hideGeneralTopic(chatId);
|
|
855
890
|
}
|
|
856
891
|
/**
|
|
857
892
|
* Context-aware alias for {@link Client.hideMemberList}.
|
|
858
893
|
*/
|
|
859
894
|
async hideMemberList() {
|
|
860
|
-
const chatId =
|
|
895
|
+
const chatId = this.#mustGetChatId();
|
|
861
896
|
return await this.client.hideMemberList(chatId);
|
|
862
897
|
}
|
|
863
898
|
/**
|
|
864
899
|
* Context-aware alias for {@link Client.kickChatMember}.
|
|
865
900
|
*/
|
|
866
901
|
async kickChatMember(memberId) {
|
|
867
|
-
const chatId =
|
|
902
|
+
const chatId = this.#mustGetChatId();
|
|
868
903
|
return await this.client.kickChatMember(chatId, memberId);
|
|
869
904
|
}
|
|
870
905
|
/**
|
|
871
906
|
* Context-aware alias for {@link Client.kickChatMember}.
|
|
872
907
|
*/
|
|
873
908
|
async kickSender() {
|
|
874
|
-
const { chatId, senderId } =
|
|
909
|
+
const { chatId, senderId } = this.#mustGetMsg();
|
|
875
910
|
if (!senderId) {
|
|
876
911
|
(0, _0_deps_js_1.unreachable)();
|
|
877
912
|
}
|
|
@@ -881,270 +916,270 @@ class Context {
|
|
|
881
916
|
* Context-aware alias for {@link Client.leaveChat}.
|
|
882
917
|
*/
|
|
883
918
|
async leaveChat() {
|
|
884
|
-
const chatId =
|
|
919
|
+
const chatId = this.#mustGetChatId();
|
|
885
920
|
return await this.client.leaveChat(chatId);
|
|
886
921
|
}
|
|
887
922
|
/**
|
|
888
923
|
* Context-aware alias for {@link Client.openChat}.
|
|
889
924
|
*/
|
|
890
925
|
async open() {
|
|
891
|
-
const chatId =
|
|
926
|
+
const chatId = this.#mustGetChatId();
|
|
892
927
|
return await this.client.openChat(chatId);
|
|
893
928
|
}
|
|
894
929
|
/**
|
|
895
930
|
* Context-aware alias for {@link Client.pauseBusinessBotConnection}.
|
|
896
931
|
*/
|
|
897
932
|
async pauseBusinessBotConnection() {
|
|
898
|
-
const chatId =
|
|
933
|
+
const chatId = this.#mustGetChatId();
|
|
899
934
|
return await this.client.pauseBusinessBotConnection(chatId);
|
|
900
935
|
}
|
|
901
936
|
/**
|
|
902
937
|
* Context-aware alias for {@link Client.pinMessage}.
|
|
903
938
|
*/
|
|
904
939
|
async pin(params) {
|
|
905
|
-
const { chatId, messageId, businessConnectionId } =
|
|
940
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
906
941
|
return await this.client.pinMessage(chatId, messageId, { ...params, businessConnectionId });
|
|
907
942
|
}
|
|
908
943
|
/**
|
|
909
944
|
* Context-aware alias for {@link Client.pinMessage}.
|
|
910
945
|
*/
|
|
911
946
|
async pinMessage(messageId, params) {
|
|
912
|
-
const chatId =
|
|
947
|
+
const chatId = this.#mustGetChatId();
|
|
913
948
|
return await this.client.pinMessage(chatId, messageId, params);
|
|
914
949
|
}
|
|
915
950
|
/**
|
|
916
951
|
* Context-aware alias for {@link Client.pinTopic}.
|
|
917
952
|
*/
|
|
918
953
|
async pinTopic(topicId) {
|
|
919
|
-
const chatId =
|
|
954
|
+
const chatId = this.#mustGetChatId();
|
|
920
955
|
return await this.client.pinTopic(chatId, topicId);
|
|
921
956
|
}
|
|
922
957
|
/**
|
|
923
958
|
* Context-aware alias for {@link Client.promoteChatMember}.
|
|
924
959
|
*/
|
|
925
960
|
async promoteChatMember(userId, params) {
|
|
926
|
-
const chatId =
|
|
961
|
+
const chatId = this.#mustGetChatId();
|
|
927
962
|
return await this.client.promoteChatMember(chatId, userId, params);
|
|
928
963
|
}
|
|
929
964
|
/**
|
|
930
965
|
* Context-aware alias for {@link Client.setReactions}.
|
|
931
966
|
*/
|
|
932
967
|
async react(reactions, params) {
|
|
933
|
-
const { chatId, messageId } =
|
|
968
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
934
969
|
return await this.client.setReactions(chatId, messageId, reactions, params);
|
|
935
970
|
}
|
|
936
971
|
/**
|
|
937
972
|
* Context-aware alias for {@link Client.readMessages}.
|
|
938
973
|
*/
|
|
939
974
|
async read() {
|
|
940
|
-
const { chatId, messageId } =
|
|
975
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
941
976
|
return await this.client.readMessages(chatId, messageId);
|
|
942
977
|
}
|
|
943
978
|
/**
|
|
944
979
|
* Context-aware alias for {@link Client.refundStarPayment}.
|
|
945
980
|
*/
|
|
946
981
|
async refundStarPayment(telegramPaymentChargeId) {
|
|
947
|
-
const chatId =
|
|
982
|
+
const chatId = this.#mustGetChatId();
|
|
948
983
|
return await this.client.refundStarPayment(chatId, telegramPaymentChargeId);
|
|
949
984
|
}
|
|
950
985
|
/**
|
|
951
986
|
* Context-aware alias for {@link Client.deleteContact}.
|
|
952
987
|
*/
|
|
953
988
|
async removeAsContact() {
|
|
954
|
-
const chatId =
|
|
989
|
+
const chatId = this.#mustGetChatId();
|
|
955
990
|
return await this.client.deleteContact(chatId);
|
|
956
991
|
}
|
|
957
992
|
/**
|
|
958
993
|
* Context-aware alias for {@link Client.removeReaction}.
|
|
959
994
|
*/
|
|
960
995
|
async removeReaction(messageId, reaction) {
|
|
961
|
-
const chatId =
|
|
996
|
+
const chatId = this.#mustGetChatId();
|
|
962
997
|
return await this.client.removeReaction(chatId, messageId, reaction);
|
|
963
998
|
}
|
|
964
999
|
/**
|
|
965
1000
|
* Context-aware alias for {@link Client.removeStoriesFromHighlights}.
|
|
966
1001
|
*/
|
|
967
1002
|
async removeStoriesFromHighlights(storyIds) {
|
|
968
|
-
const chatId =
|
|
1003
|
+
const chatId = this.#mustGetChatId();
|
|
969
1004
|
return await this.client.removeStoriesFromHighlights(chatId, storyIds);
|
|
970
1005
|
}
|
|
971
1006
|
/**
|
|
972
1007
|
* Context-aware alias for {@link Client.removeStoryFromHighlights}.
|
|
973
1008
|
*/
|
|
974
1009
|
async removeStoryFromHighlights(storyId) {
|
|
975
|
-
const chatId =
|
|
1010
|
+
const chatId = this.#mustGetChatId();
|
|
976
1011
|
return await this.client.removeStoryFromHighlights(chatId, storyId);
|
|
977
1012
|
}
|
|
978
1013
|
/**
|
|
979
1014
|
* Context-aware alias for {@link Client.reopenTopic}.
|
|
980
1015
|
*/
|
|
981
1016
|
async reopenTopic(topicId) {
|
|
982
|
-
const chatId =
|
|
1017
|
+
const chatId = this.#mustGetChatId();
|
|
983
1018
|
return await this.client.reopenTopic(chatId, topicId);
|
|
984
1019
|
}
|
|
985
1020
|
/**
|
|
986
1021
|
* Context-aware alias for {@link Client.sendMessage}.
|
|
987
1022
|
*/
|
|
988
1023
|
async reply(text, params) {
|
|
989
|
-
const { chatId, messageId, businessConnectionId } =
|
|
990
|
-
const replyTo =
|
|
1024
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1025
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
991
1026
|
return await this.client.sendMessage(chatId, text, { ...params, ...replyTo, businessConnectionId });
|
|
992
1027
|
}
|
|
993
1028
|
/**
|
|
994
1029
|
* Context-aware alias for {@link Client.sendAnimation}.
|
|
995
1030
|
*/
|
|
996
1031
|
async replyAnimation(animation, params) {
|
|
997
|
-
const { chatId, messageId, businessConnectionId } =
|
|
998
|
-
const replyTo =
|
|
1032
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1033
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
999
1034
|
return await this.client.sendAnimation(chatId, animation, { ...params, ...replyTo, businessConnectionId });
|
|
1000
1035
|
}
|
|
1001
1036
|
/**
|
|
1002
1037
|
* Context-aware alias for {@link Client.sendAudio}.
|
|
1003
1038
|
*/
|
|
1004
1039
|
async replyAudio(audio, params) {
|
|
1005
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1006
|
-
const replyTo =
|
|
1040
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1041
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1007
1042
|
return await this.client.sendAudio(chatId, audio, { ...params, ...replyTo, businessConnectionId });
|
|
1008
1043
|
}
|
|
1009
1044
|
/**
|
|
1010
1045
|
* Context-aware alias for {@link Client.sendChecklist}.
|
|
1011
1046
|
*/
|
|
1012
1047
|
async replyChecklist(title, items, params) {
|
|
1013
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1014
|
-
const replyTo =
|
|
1048
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1049
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1015
1050
|
return await this.client.sendChecklist(chatId, title, items, { ...params, ...replyTo, businessConnectionId });
|
|
1016
1051
|
}
|
|
1017
1052
|
/**
|
|
1018
1053
|
* Context-aware alias for {@link Client.sendContact}.
|
|
1019
1054
|
*/
|
|
1020
1055
|
async replyContact(firstName, number, params) {
|
|
1021
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1022
|
-
const replyTo =
|
|
1056
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1057
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1023
1058
|
return await this.client.sendContact(chatId, firstName, number, { ...params, ...replyTo, businessConnectionId });
|
|
1024
1059
|
}
|
|
1025
1060
|
/**
|
|
1026
1061
|
* Context-aware alias for {@link Client.sendDice}.
|
|
1027
1062
|
*/
|
|
1028
1063
|
async replyDice(params) {
|
|
1029
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1030
|
-
const replyTo =
|
|
1064
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1065
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1031
1066
|
return await this.client.sendDice(chatId, { ...params, ...replyTo, businessConnectionId });
|
|
1032
1067
|
}
|
|
1033
1068
|
/**
|
|
1034
1069
|
* Context-aware alias for {@link Client.sendDocument}.
|
|
1035
1070
|
*/
|
|
1036
1071
|
async replyDocument(document, params) {
|
|
1037
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1038
|
-
const replyTo =
|
|
1072
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1073
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1039
1074
|
return await this.client.sendDocument(chatId, document, { ...params, ...replyTo, businessConnectionId });
|
|
1040
1075
|
}
|
|
1041
1076
|
/**
|
|
1042
1077
|
* Context-aware alias for {@link Client.sendMessageDraft}.
|
|
1043
1078
|
*/
|
|
1044
1079
|
async replyDraft(draftId, text, params) {
|
|
1045
|
-
const { chatId, messageId } =
|
|
1046
|
-
const replyTo =
|
|
1080
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
1081
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1047
1082
|
return await this.client.sendMessageDraft(chatId, draftId, text, { ...params, ...replyTo });
|
|
1048
1083
|
}
|
|
1049
1084
|
/**
|
|
1050
1085
|
* Context-aware alias for {@link Client.sendInvoice}.
|
|
1051
1086
|
*/
|
|
1052
1087
|
async replyInvoice(title, description, payload, currency, prices, params) {
|
|
1053
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1054
|
-
const replyTo =
|
|
1088
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1089
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1055
1090
|
return await this.client.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, ...replyTo, businessConnectionId });
|
|
1056
1091
|
}
|
|
1057
1092
|
/**
|
|
1058
1093
|
* Context-aware alias for {@link Client.sendLocation}.
|
|
1059
1094
|
*/
|
|
1060
1095
|
async replyLocation(latitude, longitude, params) {
|
|
1061
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1062
|
-
const replyTo =
|
|
1096
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1097
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1063
1098
|
return await this.client.sendLocation(chatId, latitude, longitude, { ...params, ...replyTo, businessConnectionId });
|
|
1064
1099
|
}
|
|
1065
1100
|
/**
|
|
1066
1101
|
* Context-aware alias for {@link Client.sendMediaGroup}.
|
|
1067
1102
|
*/
|
|
1068
1103
|
async replyMediaGroup(media, params) {
|
|
1069
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1070
|
-
const replyTo =
|
|
1104
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1105
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1071
1106
|
return await this.client.sendMediaGroup(chatId, media, { ...params, ...replyTo, businessConnectionId });
|
|
1072
1107
|
}
|
|
1073
1108
|
/**
|
|
1074
1109
|
* Context-aware alias for {@link Client.sendPhoto}.
|
|
1075
1110
|
*/
|
|
1076
1111
|
async replyPhoto(photo, params) {
|
|
1077
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1078
|
-
const replyTo =
|
|
1112
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1113
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1079
1114
|
return await this.client.sendPhoto(chatId, photo, { ...params, ...replyTo, businessConnectionId });
|
|
1080
1115
|
}
|
|
1081
1116
|
/**
|
|
1082
1117
|
* Context-aware alias for {@link Client.sendPoll}.
|
|
1083
1118
|
*/
|
|
1084
1119
|
async replyPoll(question, options, params) {
|
|
1085
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1086
|
-
const replyTo =
|
|
1120
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1121
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1087
1122
|
return await this.client.sendPoll(chatId, question, options, { ...params, ...replyTo, businessConnectionId });
|
|
1088
1123
|
}
|
|
1089
1124
|
/**
|
|
1090
1125
|
* Context-aware alias for {@link Client.sendSticker}.
|
|
1091
1126
|
*/
|
|
1092
1127
|
async replySticker(sticker, params) {
|
|
1093
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1094
|
-
const replyTo =
|
|
1128
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1129
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1095
1130
|
return await this.client.sendSticker(chatId, sticker, { ...params, ...replyTo, businessConnectionId });
|
|
1096
1131
|
}
|
|
1097
1132
|
/**
|
|
1098
1133
|
* Context-aware alias for {@link Client.sendVenue}.
|
|
1099
1134
|
*/
|
|
1100
1135
|
async replyVenue(latitude, longitude, title, address, params) {
|
|
1101
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1102
|
-
const replyTo =
|
|
1136
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1137
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1103
1138
|
return await this.client.sendVenue(chatId, latitude, longitude, title, address, { ...params, ...replyTo, businessConnectionId });
|
|
1104
1139
|
}
|
|
1105
1140
|
/**
|
|
1106
1141
|
* Context-aware alias for {@link Client.sendVideo}.
|
|
1107
1142
|
*/
|
|
1108
1143
|
async replyVideo(video, params) {
|
|
1109
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1110
|
-
const replyTo =
|
|
1144
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1145
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1111
1146
|
return await this.client.sendVideo(chatId, video, { ...params, ...replyTo, businessConnectionId });
|
|
1112
1147
|
}
|
|
1113
1148
|
/**
|
|
1114
1149
|
* Context-aware alias for {@link Client.sendVideoNote}.
|
|
1115
1150
|
*/
|
|
1116
1151
|
async replyVideoNote(videoNote, params) {
|
|
1117
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1118
|
-
const replyTo =
|
|
1152
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1153
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1119
1154
|
return await this.client.sendVideoNote(chatId, videoNote, { ...params, ...replyTo, businessConnectionId });
|
|
1120
1155
|
}
|
|
1121
1156
|
/**
|
|
1122
1157
|
* Context-aware alias for {@link Client.sendVoice}.
|
|
1123
1158
|
*/
|
|
1124
1159
|
async replyVoice(voice, params) {
|
|
1125
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1126
|
-
const replyTo =
|
|
1160
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1161
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1127
1162
|
return await this.client.sendVoice(chatId, voice, { ...params, ...replyTo, businessConnectionId });
|
|
1128
1163
|
}
|
|
1129
1164
|
/**
|
|
1130
1165
|
* Context-aware alias for {@link Client.resumeBusinessBotConnection}.
|
|
1131
1166
|
*/
|
|
1132
1167
|
async resumeBusinessBotConnection() {
|
|
1133
|
-
const chatId =
|
|
1168
|
+
const chatId = this.#mustGetChatId();
|
|
1134
1169
|
return await this.client.resumeBusinessBotConnection(chatId);
|
|
1135
1170
|
}
|
|
1136
1171
|
/**
|
|
1137
1172
|
* Context-aware alias for {@link Client.scheduleVideoChat}.
|
|
1138
1173
|
*/
|
|
1139
1174
|
async scheduleVideoChat(startAt, params) {
|
|
1140
|
-
const chatId =
|
|
1175
|
+
const chatId = this.#mustGetChatId();
|
|
1141
1176
|
return await this.client.scheduleVideoChat(chatId, startAt, params);
|
|
1142
1177
|
}
|
|
1143
1178
|
/**
|
|
1144
1179
|
* Context-aware alias for {@link Client.searchMessages}.
|
|
1145
1180
|
*/
|
|
1146
1181
|
async searchMessages(params) {
|
|
1147
|
-
const chatId =
|
|
1182
|
+
const chatId = this.#mustGetChatId();
|
|
1148
1183
|
params ??= {};
|
|
1149
1184
|
params.chatId = chatId;
|
|
1150
1185
|
return await this.client.searchMessages(params);
|
|
@@ -1153,77 +1188,77 @@ class Context {
|
|
|
1153
1188
|
* Context-aware alias for {@link Client.sendChatAction}.
|
|
1154
1189
|
*/
|
|
1155
1190
|
async sendChatAction(action, params) {
|
|
1156
|
-
const chatId =
|
|
1191
|
+
const chatId = this.#mustGetChatId();
|
|
1157
1192
|
return await this.client.sendChatAction(chatId, action, params);
|
|
1158
1193
|
}
|
|
1159
1194
|
/**
|
|
1160
1195
|
* Context-aware alias for {@link Client.sendScheduledMessage}.
|
|
1161
1196
|
*/
|
|
1162
1197
|
async sendScheduledMessage(messageId) {
|
|
1163
|
-
const chatId =
|
|
1198
|
+
const chatId = this.#mustGetChatId();
|
|
1164
1199
|
return await this.client.sendScheduledMessage(chatId, messageId);
|
|
1165
1200
|
}
|
|
1166
1201
|
/**
|
|
1167
1202
|
* Context-aware alias for {@link Client.setAvailableReactions}.
|
|
1168
1203
|
*/
|
|
1169
1204
|
async setAvailableReactions(availableReactions) {
|
|
1170
|
-
const chatId =
|
|
1205
|
+
const chatId = this.#mustGetChatId();
|
|
1171
1206
|
return await this.client.setAvailableReactions(chatId, availableReactions);
|
|
1172
1207
|
}
|
|
1173
1208
|
/**
|
|
1174
1209
|
* Context-aware alias for {@link Client.setBoostsRequiredToCircumventRestrictions}.
|
|
1175
1210
|
*/
|
|
1176
1211
|
async setBoostsRequiredToCircumventRestrictions(boosts) {
|
|
1177
|
-
const chatId =
|
|
1212
|
+
const chatId = this.#mustGetChatId();
|
|
1178
1213
|
return await this.client.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
|
|
1179
1214
|
}
|
|
1180
1215
|
/**
|
|
1181
1216
|
* Context-aware alias for {@link Client.setChatDescription}.
|
|
1182
1217
|
*/
|
|
1183
1218
|
async setChatDescription(description) {
|
|
1184
|
-
const chatId =
|
|
1219
|
+
const chatId = this.#mustGetChatId();
|
|
1185
1220
|
return await this.client.setChatDescription(chatId, description);
|
|
1186
1221
|
}
|
|
1187
1222
|
/**
|
|
1188
1223
|
* Context-aware alias for {@link Client.setChatMemberRights}.
|
|
1189
1224
|
*/
|
|
1190
1225
|
async setChatMemberRights(memberId, params) {
|
|
1191
|
-
const chatId =
|
|
1226
|
+
const chatId = this.#mustGetChatId();
|
|
1192
1227
|
return await this.client.setChatMemberRights(chatId, memberId, params);
|
|
1193
1228
|
}
|
|
1194
1229
|
/**
|
|
1195
1230
|
* Context-aware alias for {@link Client.setChatPhoto}.
|
|
1196
1231
|
*/
|
|
1197
1232
|
async setChatPhoto(photo, params) {
|
|
1198
|
-
const chatId =
|
|
1233
|
+
const chatId = this.#mustGetChatId();
|
|
1199
1234
|
return await this.client.setChatPhoto(chatId, photo, params);
|
|
1200
1235
|
}
|
|
1201
1236
|
/**
|
|
1202
1237
|
* Context-aware alias for {@link Client.setChatStickerSet}.
|
|
1203
1238
|
*/
|
|
1204
1239
|
async setChatStickerSet(setName) {
|
|
1205
|
-
const chatId =
|
|
1240
|
+
const chatId = this.#mustGetChatId();
|
|
1206
1241
|
return await this.client.setChatStickerSet(chatId, setName);
|
|
1207
1242
|
}
|
|
1208
1243
|
/**
|
|
1209
1244
|
* Context-aware alias for {@link Client.setChatTitle}.
|
|
1210
1245
|
*/
|
|
1211
1246
|
async setChatTitle(title) {
|
|
1212
|
-
const chatId =
|
|
1247
|
+
const chatId = this.#mustGetChatId();
|
|
1213
1248
|
return await this.client.setChatTitle(chatId, title);
|
|
1214
1249
|
}
|
|
1215
1250
|
/**
|
|
1216
1251
|
* Context-aware alias for {@link Client.setDiscussionChat}.
|
|
1217
1252
|
*/
|
|
1218
1253
|
async setDiscussionChat(discussionChatId) {
|
|
1219
|
-
const chatId =
|
|
1254
|
+
const chatId = this.#mustGetChatId();
|
|
1220
1255
|
return await this.client.setDiscussionChat(chatId, discussionChatId);
|
|
1221
1256
|
}
|
|
1222
1257
|
/**
|
|
1223
1258
|
* Context-aware alias for {@link Client.setChatMemberTag}.
|
|
1224
1259
|
*/
|
|
1225
1260
|
async setMemberTag(params) {
|
|
1226
|
-
const { chatId, userId } =
|
|
1261
|
+
const { chatId, userId } = this.#mustGetMsg();
|
|
1227
1262
|
if (!userId) {
|
|
1228
1263
|
(0, _0_deps_js_1.unreachable)();
|
|
1229
1264
|
}
|
|
@@ -1233,21 +1268,21 @@ class Context {
|
|
|
1233
1268
|
* Context-aware alias for {@link Client.setMessageTtl}.
|
|
1234
1269
|
*/
|
|
1235
1270
|
async setMessageTtl(messageTtl) {
|
|
1236
|
-
const chatId =
|
|
1271
|
+
const chatId = this.#mustGetChatId();
|
|
1237
1272
|
return await this.client.setMessageTtl(chatId, messageTtl);
|
|
1238
1273
|
}
|
|
1239
1274
|
/**
|
|
1240
1275
|
* Context-aware alias for {@link Client.setReactions}.
|
|
1241
1276
|
*/
|
|
1242
1277
|
async setReactions(messageId, reactions, params) {
|
|
1243
|
-
const chatId =
|
|
1278
|
+
const chatId = this.#mustGetChatId();
|
|
1244
1279
|
return await this.client.setReactions(chatId, messageId, reactions, params);
|
|
1245
1280
|
}
|
|
1246
1281
|
/**
|
|
1247
1282
|
* Context-aware alias for {@link Client.setChatMemberRights}.
|
|
1248
1283
|
*/
|
|
1249
1284
|
async setSenderRights(params) {
|
|
1250
|
-
const { chatId, senderId } =
|
|
1285
|
+
const { chatId, senderId } = this.#mustGetMsg();
|
|
1251
1286
|
if (!senderId) {
|
|
1252
1287
|
(0, _0_deps_js_1.unreachable)();
|
|
1253
1288
|
}
|
|
@@ -1257,169 +1292,119 @@ class Context {
|
|
|
1257
1292
|
* Context-aware alias for {@link Client.setSlowMode}.
|
|
1258
1293
|
*/
|
|
1259
1294
|
async setSlowMode(duration) {
|
|
1260
|
-
const chatId =
|
|
1295
|
+
const chatId = this.#mustGetChatId();
|
|
1261
1296
|
return await this.client.setSlowMode(chatId, duration);
|
|
1262
1297
|
}
|
|
1263
1298
|
/**
|
|
1264
1299
|
* Context-aware alias for {@link Client.showGeneralTopic}.
|
|
1265
1300
|
*/
|
|
1266
1301
|
async showGeneralTopic() {
|
|
1267
|
-
const chatId =
|
|
1302
|
+
const chatId = this.#mustGetChatId();
|
|
1268
1303
|
return await this.client.showGeneralTopic(chatId);
|
|
1269
1304
|
}
|
|
1270
1305
|
/**
|
|
1271
1306
|
* Context-aware alias for {@link Client.showMemberList}.
|
|
1272
1307
|
*/
|
|
1273
1308
|
async showMemberList() {
|
|
1274
|
-
const chatId =
|
|
1309
|
+
const chatId = this.#mustGetChatId();
|
|
1275
1310
|
return await this.client.showMemberList(chatId);
|
|
1276
1311
|
}
|
|
1277
1312
|
/**
|
|
1278
1313
|
* Context-aware alias for {@link Client.startVideoChat}.
|
|
1279
1314
|
*/
|
|
1280
1315
|
async startVideoChat(params) {
|
|
1281
|
-
const chatId =
|
|
1316
|
+
const chatId = this.#mustGetChatId();
|
|
1282
1317
|
return await this.client.startVideoChat(chatId, params);
|
|
1283
1318
|
}
|
|
1284
1319
|
/**
|
|
1285
1320
|
* Context-aware alias for {@link Client.stopPoll}.
|
|
1286
1321
|
*/
|
|
1287
1322
|
async stopPoll(messageId, params) {
|
|
1288
|
-
const chatId =
|
|
1323
|
+
const chatId = this.#mustGetChatId();
|
|
1289
1324
|
return await this.client.stopPoll(chatId, messageId, params);
|
|
1290
1325
|
}
|
|
1291
1326
|
/**
|
|
1292
1327
|
* Context-aware alias for {@link Client.transcribeVoice}.
|
|
1293
1328
|
*/
|
|
1294
1329
|
async transcribeVoice(messageId) {
|
|
1295
|
-
const chatId =
|
|
1330
|
+
const chatId = this.#mustGetChatId();
|
|
1296
1331
|
return await this.client.transcribeVoice(chatId, messageId);
|
|
1297
1332
|
}
|
|
1298
1333
|
/**
|
|
1299
1334
|
* Context-aware alias for {@link Client.transferChatOwnership}.
|
|
1300
1335
|
*/
|
|
1301
1336
|
async transferOwnership(userId, password) {
|
|
1302
|
-
const chatId =
|
|
1337
|
+
const chatId = this.#mustGetChatId();
|
|
1303
1338
|
return await this.client.transferChatOwnership(chatId, userId, password);
|
|
1304
1339
|
}
|
|
1305
1340
|
/**
|
|
1306
1341
|
* Context-aware alias for {@link Client.unarchiveChat}.
|
|
1307
1342
|
*/
|
|
1308
1343
|
async unarchive() {
|
|
1309
|
-
const chatId =
|
|
1344
|
+
const chatId = this.#mustGetChatId();
|
|
1310
1345
|
return await this.client.unarchiveChat(chatId);
|
|
1311
1346
|
}
|
|
1312
1347
|
/**
|
|
1313
1348
|
* Context-aware alias for {@link Client.unbanChatMember}.
|
|
1314
1349
|
*/
|
|
1315
1350
|
async unbanChatMember(memberId) {
|
|
1316
|
-
const chatId =
|
|
1351
|
+
const chatId = this.#mustGetChatId();
|
|
1317
1352
|
return await this.client.unbanChatMember(chatId, memberId);
|
|
1318
1353
|
}
|
|
1319
1354
|
/**
|
|
1320
1355
|
* Context-aware alias for {@link Client.unblockUser}.
|
|
1321
1356
|
*/
|
|
1322
1357
|
async unblockUser() {
|
|
1323
|
-
return await this.client.unblockUser(
|
|
1358
|
+
return await this.client.unblockUser(this.#mustGetUserId());
|
|
1324
1359
|
}
|
|
1325
1360
|
/**
|
|
1326
1361
|
* Context-aware alias for {@link Client.uncheckChecklistItem}.
|
|
1327
1362
|
*/
|
|
1328
1363
|
async uncheckChecklistItem(messageId, item) {
|
|
1329
|
-
const chatId =
|
|
1364
|
+
const chatId = this.#mustGetChatId();
|
|
1330
1365
|
return await this.client.uncheckChecklistItem(chatId, messageId, item);
|
|
1331
1366
|
}
|
|
1332
1367
|
/**
|
|
1333
1368
|
* Context-aware alias for {@link Client.uncheckChecklistItems}.
|
|
1334
1369
|
*/
|
|
1335
1370
|
async uncheckChecklistItems(messageId, items) {
|
|
1336
|
-
const chatId =
|
|
1371
|
+
const chatId = this.#mustGetChatId();
|
|
1337
1372
|
return await this.client.uncheckChecklistItems(chatId, messageId, items);
|
|
1338
1373
|
}
|
|
1339
1374
|
/**
|
|
1340
1375
|
* Context-aware alias for {@link Client.unpinMessage}.
|
|
1341
1376
|
*/
|
|
1342
1377
|
async unpin() {
|
|
1343
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1378
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1344
1379
|
return await this.client.unpinMessage(chatId, messageId, { businessConnectionId });
|
|
1345
1380
|
}
|
|
1346
1381
|
/**
|
|
1347
1382
|
* Context-aware alias for {@link Client.unpinMessage}.
|
|
1348
1383
|
*/
|
|
1349
1384
|
async unpinMessage(messageId) {
|
|
1350
|
-
const chatId =
|
|
1385
|
+
const chatId = this.#mustGetChatId();
|
|
1351
1386
|
return await this.client.unpinMessage(chatId, messageId);
|
|
1352
1387
|
}
|
|
1353
1388
|
/**
|
|
1354
1389
|
* Context-aware alias for {@link Client.unpinMessages}.
|
|
1355
1390
|
*/
|
|
1356
1391
|
async unpinMessages() {
|
|
1357
|
-
const chatId =
|
|
1392
|
+
const chatId = this.#mustGetChatId();
|
|
1358
1393
|
return await this.client.unpinMessages(chatId);
|
|
1359
1394
|
}
|
|
1360
1395
|
/**
|
|
1361
1396
|
* Context-aware alias for {@link Client.unpinTopic}.
|
|
1362
1397
|
*/
|
|
1363
1398
|
async unpinTopic(topicId) {
|
|
1364
|
-
const chatId =
|
|
1399
|
+
const chatId = this.#mustGetChatId();
|
|
1365
1400
|
return await this.client.unpinTopic(chatId, topicId);
|
|
1366
1401
|
}
|
|
1367
1402
|
/**
|
|
1368
1403
|
* Context-aware alias for {@link Client.updateChecklist}.
|
|
1369
1404
|
*/
|
|
1370
1405
|
async updateChecklist(messageId, params) {
|
|
1371
|
-
const chatId =
|
|
1406
|
+
const chatId = this.#mustGetChatId();
|
|
1372
1407
|
return await this.client.updateChecklist(chatId, messageId, params);
|
|
1373
1408
|
}
|
|
1374
1409
|
}
|
|
1375
1410
|
exports.Context = Context;
|
|
1376
|
-
_Context_client = new WeakMap(), _Context_me = new WeakMap(), _Context_update = new WeakMap(), _Context_getReplyTo = new WeakMap(), _Context_instances = new WeakSet(), _Context_mustGetMsg = function _Context_mustGetMsg() {
|
|
1377
|
-
if (this.msg !== undefined) {
|
|
1378
|
-
return { chatId: this.msg.chat.id, messageId: this.msg.id, businessConnectionId: this.msg.businessConnectionId, senderId: this.msg.from?.id, userId: this.msg.from?.id };
|
|
1379
|
-
}
|
|
1380
|
-
const reactions = "messageInteractions" in this.update ? this.update.messageInteractions : undefined;
|
|
1381
|
-
if (reactions !== undefined) {
|
|
1382
|
-
return { chatId: reactions.chatId, messageId: reactions.messageId };
|
|
1383
|
-
}
|
|
1384
|
-
else {
|
|
1385
|
-
(0, _0_deps_js_1.unreachable)();
|
|
1386
|
-
}
|
|
1387
|
-
}, _Context_mustGetChatId = function _Context_mustGetChatId() {
|
|
1388
|
-
if (this.chat) {
|
|
1389
|
-
return this.chat.id;
|
|
1390
|
-
}
|
|
1391
|
-
else {
|
|
1392
|
-
(0, _0_deps_js_1.unreachable)();
|
|
1393
|
-
}
|
|
1394
|
-
}, _Context_mustGetUserId = function _Context_mustGetUserId() {
|
|
1395
|
-
if (this.msg?.from) {
|
|
1396
|
-
return this.msg.from.id;
|
|
1397
|
-
}
|
|
1398
|
-
else if ("callbackQuery" in this.update) {
|
|
1399
|
-
return this.update.callbackQuery.from.id;
|
|
1400
|
-
}
|
|
1401
|
-
else if ("chosenInlineResult" in this.update) {
|
|
1402
|
-
return this.update.chosenInlineResult.from.id;
|
|
1403
|
-
}
|
|
1404
|
-
else {
|
|
1405
|
-
(0, _0_deps_js_1.unreachable)();
|
|
1406
|
-
}
|
|
1407
|
-
}, _Context_mustGetInlineMsgId = function _Context_mustGetInlineMsgId() {
|
|
1408
|
-
if ("chosenInlineResult" in this.update) {
|
|
1409
|
-
if (this.update.chosenInlineResult.inlineMessageId) {
|
|
1410
|
-
return this.update.chosenInlineResult.inlineMessageId;
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
else if ("callbackQuery" in this.update) {
|
|
1414
|
-
if (this.update.callbackQuery.inlineMessageId) {
|
|
1415
|
-
return this.update.callbackQuery.inlineMessageId;
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
(0, _0_deps_js_1.unreachable)();
|
|
1419
|
-
};
|
|
1420
|
-
Object.defineProperty(Context, "has", {
|
|
1421
|
-
enumerable: true,
|
|
1422
|
-
configurable: true,
|
|
1423
|
-
writable: true,
|
|
1424
|
-
value: staticHas
|
|
1425
|
-
});
|