@mtkruto/node 0.79.1 → 0.79.4

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.
Files changed (37) hide show
  1. package/esm/client/1_client_generic.d.ts +3 -2
  2. package/esm/client/1_client_generic.d.ts.map +1 -1
  3. package/esm/client/2_account_manager.d.ts.map +1 -1
  4. package/esm/client/2_account_manager.js +2 -4
  5. package/esm/client/2_context.d.ts +235 -0
  6. package/esm/client/2_context.d.ts.map +1 -1
  7. package/esm/client/2_context.js +235 -0
  8. package/esm/client/5_client_dispatcher.d.ts +6 -5
  9. package/esm/client/5_client_dispatcher.d.ts.map +1 -1
  10. package/esm/client/5_client_dispatcher.js +4 -1
  11. package/esm/tl/1_telegram_api.d.ts +2290 -1
  12. package/esm/tl/1_telegram_api.d.ts.map +1 -1
  13. package/esm/tl/1_telegram_api.js +1 -1
  14. package/esm/types/2_chat_member.d.ts +57 -6
  15. package/esm/types/2_chat_member.d.ts.map +1 -1
  16. package/esm/types/8_update.d.ts +23 -23
  17. package/esm/utilities/0_int.d.ts +2 -2
  18. package/esm/utilities/0_int.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/script/client/1_client_generic.d.ts +3 -2
  21. package/script/client/1_client_generic.d.ts.map +1 -1
  22. package/script/client/2_account_manager.d.ts.map +1 -1
  23. package/script/client/2_account_manager.js +2 -4
  24. package/script/client/2_context.d.ts +235 -0
  25. package/script/client/2_context.d.ts.map +1 -1
  26. package/script/client/2_context.js +235 -0
  27. package/script/client/5_client_dispatcher.d.ts +6 -5
  28. package/script/client/5_client_dispatcher.d.ts.map +1 -1
  29. package/script/client/5_client_dispatcher.js +4 -1
  30. package/script/tl/1_telegram_api.d.ts +2290 -1
  31. package/script/tl/1_telegram_api.d.ts.map +1 -1
  32. package/script/tl/1_telegram_api.js +1 -1
  33. package/script/types/2_chat_member.d.ts +57 -6
  34. package/script/types/2_chat_member.d.ts.map +1 -1
  35. package/script/types/8_update.d.ts +23 -23
  36. package/script/utilities/0_int.d.ts +2 -2
  37. package/script/utilities/0_int.d.ts.map +1 -1
@@ -22,6 +22,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.Context = void 0;
23
23
  const _0_deps_js_1 = require("../0_deps.js");
24
24
  const _2_tl_js_1 = require("../2_tl.js");
25
+ /**
26
+ * The context object that is passed to the client's update handlers.
27
+ *
28
+ * It wraps the {@link Update} type with shortcuts and method aliases.
29
+ */
25
30
  class Context {
26
31
  #client;
27
32
  #me;
@@ -105,6 +110,11 @@ class Context {
105
110
  const from = "callbackQuery" in this.update ? this.update.callbackQuery.from : "inlineQuery" in this.update ? this.update.inlineQuery.from : "chatMember" in this.update ? this.update.chatMember.from : "myChatMember" in this.update ? this.update.myChatMember.from : "messageReactions" in this.update ? this.update.messageReactions.user : "preCheckoutQuery" in this.update ? this.update.preCheckoutQuery.from : "joinRequest" in this.update ? this.update.joinRequest.from : "businessConnection" in this.update ? this.update.businessConnection.user : "pollAnswer" in this.update ? this.update.pollAnswer.from : this.msg?.from;
106
111
  return from;
107
112
  }
113
+ /**
114
+ * Returns a representation of the update held in the context that can be converted to JSON.
115
+ *
116
+ * @returns A representation of the update in a way that can be converted to JSON.
117
+ */
108
118
  toJSON() {
109
119
  if ("update" in this.update) {
110
120
  return { update: (0, _2_tl_js_1.toJSON)(this.update.update) };
@@ -113,102 +123,165 @@ class Context {
113
123
  return this.update;
114
124
  }
115
125
  }
126
+ /**
127
+ * Context-aware alias for {@link Client.sendMessage}.
128
+ */
116
129
  async reply(text, params) {
117
130
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
118
131
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
119
132
  return await this.client.sendMessage(chatId, text, { ...params, replyTo, businessConnectionId });
120
133
  }
134
+ /**
135
+ * Context-aware alias for {@link Client.sendPoll}.
136
+ */
121
137
  async replyPoll(question, options, params) {
122
138
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
123
139
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
124
140
  return await this.client.sendPoll(chatId, question, options, { ...params, replyTo, businessConnectionId });
125
141
  }
142
+ /**
143
+ * Context-aware alias for {@link Client.sendPhoto}.
144
+ */
126
145
  async replyPhoto(photo, params) {
127
146
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
128
147
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
129
148
  return await this.client.sendPhoto(chatId, photo, { ...params, replyTo, businessConnectionId });
130
149
  }
150
+ /**
151
+ * Context-aware alias for {@link Client.sendMediaGroup}.
152
+ */
131
153
  async replyMediaGroup(media, params) {
132
154
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
133
155
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
134
156
  return await this.client.sendMediaGroup(chatId, media, { ...params, replyTo, businessConnectionId });
135
157
  }
158
+ /**
159
+ * Context-aware alias for {@link Client.sendInvoice}.
160
+ */
136
161
  async replyInvoice(title, description, payload, currency, prices, params) {
137
162
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
138
163
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
139
164
  return await this.client.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, replyTo, businessConnectionId });
140
165
  }
166
+ /**
167
+ * Context-aware alias for {@link Client.sendDocument}.
168
+ */
141
169
  async replyDocument(document, params) {
142
170
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
143
171
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
144
172
  return await this.client.sendDocument(chatId, document, { ...params, replyTo, businessConnectionId });
145
173
  }
174
+ /**
175
+ * Context-aware alias for {@link Client.sendSticker}.
176
+ */
146
177
  async replySticker(sticker, params) {
147
178
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
148
179
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
149
180
  return await this.client.sendSticker(chatId, sticker, { ...params, replyTo, businessConnectionId });
150
181
  }
182
+ /**
183
+ * Context-aware alias for {@link Client.sendLocation}.
184
+ */
151
185
  async replyLocation(latitude, longitude, params) {
152
186
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
153
187
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
154
188
  return await this.client.sendLocation(chatId, latitude, longitude, { ...params, replyTo, businessConnectionId });
155
189
  }
190
+ /**
191
+ * Context-aware alias for {@link Client.sendDice}.
192
+ */
156
193
  async replyDice(params) {
157
194
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
158
195
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
159
196
  return await this.client.sendDice(chatId, { ...params, replyTo, businessConnectionId });
160
197
  }
198
+ /**
199
+ * Context-aware alias for {@link Client.sendVenue}.
200
+ */
161
201
  async replyVenue(latitude, longitude, title, address, params) {
162
202
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
163
203
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
164
204
  return await this.client.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyTo, businessConnectionId });
165
205
  }
206
+ /**
207
+ * Context-aware alias for {@link Client.sendContact}.
208
+ */
166
209
  async replyContact(firstName, number, params) {
167
210
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
168
211
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
169
212
  return await this.client.sendContact(chatId, firstName, number, { ...params, replyTo, businessConnectionId });
170
213
  }
214
+ /**
215
+ * Context-aware alias for {@link Client.sendVideo}.
216
+ */
171
217
  async replyVideo(video, params) {
172
218
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
173
219
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
174
220
  return await this.client.sendVideo(chatId, video, { ...params, replyTo, businessConnectionId });
175
221
  }
222
+ /**
223
+ * Context-aware alias for {@link Client.sendAnimation}.
224
+ */
176
225
  async replyAnimation(animation, params) {
177
226
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
178
227
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
179
228
  return await this.client.sendAnimation(chatId, animation, { ...params, replyTo, businessConnectionId });
180
229
  }
230
+ /**
231
+ * Context-aware alias for {@link Client.sendVoice}.
232
+ */
181
233
  async replyVoice(voice, params) {
182
234
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
183
235
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
184
236
  return await this.client.sendVoice(chatId, voice, { ...params, replyTo, businessConnectionId });
185
237
  }
238
+ /**
239
+ * Context-aware alias for {@link Client.sendAudio}.
240
+ */
186
241
  async replyAudio(audio, params) {
187
242
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
188
243
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
189
244
  return await this.client.sendAudio(chatId, audio, { ...params, replyTo, businessConnectionId });
190
245
  }
246
+ /**
247
+ * Context-aware alias for {@link Client.sendVideoNote}.
248
+ */
191
249
  async replyVideoNote(videoNote, params) {
192
250
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
193
251
  const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
194
252
  return await this.client.sendVideoNote(chatId, videoNote, { ...params, replyTo, businessConnectionId });
195
253
  }
254
+ /**
255
+ * Context-aware alias for {@link Client.deleteMessage}.
256
+ */
196
257
  async delete() {
197
258
  const { chatId, messageId } = this.#mustGetMsg();
198
259
  return await this.client.deleteMessage(chatId, messageId);
199
260
  }
261
+ /**
262
+ * Context-aware alias for {@link Client.forwardMessage}.
263
+ */
200
264
  async forward(to, params) {
201
265
  const { chatId, messageId } = this.#mustGetMsg();
202
266
  return await this.client.forwardMessage(chatId, to, messageId, params);
203
267
  }
268
+ /**
269
+ * Context-aware alias for {@link Client.pinMessage}.
270
+ */
204
271
  async pin(params) {
205
272
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
206
273
  return await this.client.pinMessage(chatId, messageId, { ...params, businessConnectionId });
207
274
  }
275
+ /**
276
+ * Context-aware alias for {@link Client.unpinMessage}.
277
+ */
208
278
  async unpin() {
209
279
  const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
210
280
  return await this.client.unpinMessage(chatId, messageId, { businessConnectionId });
211
281
  }
282
+ /**
283
+ * Context-aware alias for {@link Client.banChatMember}.
284
+ */
212
285
  async banSender(params) {
213
286
  const { chatId, senderId } = this.#mustGetMsg();
214
287
  if (!senderId) {
@@ -216,6 +289,9 @@ class Context {
216
289
  }
217
290
  return await this.client.banChatMember(chatId, senderId, params);
218
291
  }
292
+ /**
293
+ * Context-aware alias for {@link Client.kickChatMember}.
294
+ */
219
295
  async kickSender() {
220
296
  const { chatId, senderId } = this.#mustGetMsg();
221
297
  if (!senderId) {
@@ -223,6 +299,9 @@ class Context {
223
299
  }
224
300
  return await this.client.kickChatMember(chatId, senderId);
225
301
  }
302
+ /**
303
+ * Context-aware alias for {@link Client.setChatMemberRights}.
304
+ */
226
305
  async setSenderRights(params) {
227
306
  const { chatId, senderId } = this.#mustGetMsg();
228
307
  if (!senderId) {
@@ -230,202 +309,349 @@ class Context {
230
309
  }
231
310
  return await this.client.setChatMemberRights(chatId, senderId, params);
232
311
  }
312
+ /**
313
+ * Context-aware alias for {@link Client.getChatAdministrators}.
314
+ */
233
315
  async getChatAdministrators() {
234
316
  const chatId = this.#mustGetChatId();
235
317
  return await this.client.getChatAdministrators(chatId);
236
318
  }
319
+ /**
320
+ * Context-aware alias for {@link Client.setReactions}.
321
+ */
237
322
  async react(reactions, params) {
238
323
  const { chatId, messageId } = this.#mustGetMsg();
239
324
  return await this.client.setReactions(chatId, messageId, reactions, params);
240
325
  }
326
+ /**
327
+ * Context-aware alias for {@link Client.sendChatAction}.
328
+ */
241
329
  async sendChatAction(action, params) {
242
330
  const chatId = this.#mustGetChatId();
243
331
  return await this.client.sendChatAction(chatId, action, params);
244
332
  }
333
+ /**
334
+ * Context-aware alias for {@link Client.editInlineMessageText}.
335
+ */
245
336
  async editInlineMessageText(text, params) {
246
337
  const inlineMessageId = this.#mustGetInlineMsgId();
247
338
  return await this.client.editInlineMessageText(inlineMessageId, text, params);
248
339
  }
340
+ /**
341
+ * Context-aware alias for {@link Client.editInlineMessageCaption}.
342
+ */
249
343
  async editInlineMessageCaption(params) {
250
344
  const inlineMessageId = this.#mustGetInlineMsgId();
251
345
  return await this.client.editInlineMessageCaption(inlineMessageId, params);
252
346
  }
347
+ /**
348
+ * Context-aware alias for {@link Client.editInlineMessageMedia}.
349
+ */
253
350
  async editInlineMessageMedia(media, params) {
254
351
  const inlineMessageId = this.#mustGetInlineMsgId();
255
352
  return await this.client.editInlineMessageMedia(inlineMessageId, media, params);
256
353
  }
354
+ /**
355
+ * Context-aware alias for {@link Client.editInlineMessageLiveLocation}.
356
+ */
257
357
  async editInlineMessageLiveLocation(latitude, longitude, params) {
258
358
  const inlineMessageId = this.#mustGetInlineMsgId();
259
359
  return await this.client.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
260
360
  }
361
+ /**
362
+ * Context-aware alias for {@link Client.editInlineMessageReplyMarkup}.
363
+ */
261
364
  async editInlineMessageReplyMarkup(params) {
262
365
  const inlineMessageId = this.#mustGetInlineMsgId();
263
366
  return await this.client.editInlineMessageReplyMarkup(inlineMessageId, params);
264
367
  }
368
+ /**
369
+ * Context-aware alias for {@link Client.editMessageText}.
370
+ */
265
371
  async editMessageText(messageId, text, params) {
266
372
  const chatId = this.#mustGetChatId();
267
373
  return await this.client.editMessageText(chatId, messageId, text, params);
268
374
  }
375
+ /**
376
+ * Context-aware alias for {@link Client.editMessageCaption}.
377
+ */
269
378
  async editMessageCaption(messageId, params) {
270
379
  const chatId = this.#mustGetChatId();
271
380
  return await this.client.editMessageCaption(chatId, messageId, params);
272
381
  }
382
+ /**
383
+ * Context-aware alias for {@link Client.editMessageMedia}.
384
+ */
273
385
  async editMessageMedia(messageId, media, params) {
274
386
  const chatId = this.#mustGetChatId();
275
387
  return await this.client.editMessageMedia(chatId, messageId, media, params);
276
388
  }
389
+ /**
390
+ * Context-aware alias for {@link Client.editMessageLiveLocation}.
391
+ */
277
392
  async editMessageLiveLocation(messageId, latitude, longitude, params) {
278
393
  const chatId = this.#mustGetChatId();
279
394
  return await this.client.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
280
395
  }
396
+ /**
397
+ * Context-aware alias for {@link Client.editMessageReplyMarkup}.
398
+ */
281
399
  async editMessageReplyMarkup(messageId, params) {
282
400
  const chatId = this.#mustGetChatId();
283
401
  return await this.client.editMessageReplyMarkup(chatId, messageId, params);
284
402
  }
403
+ /**
404
+ * Context-aware alias for {@link Client.answerCallbackQuery}.
405
+ */
285
406
  async answerCallbackQuery(params) {
286
407
  if (!("callbackQuery" in this.update)) {
287
408
  (0, _0_deps_js_1.unreachable)();
288
409
  }
289
410
  return await this.client.answerCallbackQuery(this.update.callbackQuery.id, params);
290
411
  }
412
+ /**
413
+ * Context-aware alias for {@link Client.answerInlineQuery}.
414
+ */
291
415
  async answerInlineQuery(results, params) {
292
416
  if (!("inlineQuery" in this.update)) {
293
417
  (0, _0_deps_js_1.unreachable)();
294
418
  }
295
419
  return await this.client.answerInlineQuery(this.update.inlineQuery.id, results, params);
296
420
  }
421
+ /**
422
+ * Context-aware alias for {@link Client.getMessage}.
423
+ */
297
424
  async getMessage(messageId) {
298
425
  const chatId = this.#mustGetChatId();
299
426
  return await this.client.getMessage(chatId, messageId);
300
427
  }
428
+ /**
429
+ * Context-aware alias for {@link Client.getMessages}.
430
+ */
301
431
  async getMessages(messageIds) {
302
432
  const chatId = this.#mustGetChatId();
303
433
  return await this.client.getMessages(chatId, messageIds);
304
434
  }
435
+ /**
436
+ * Context-aware alias for {@link Client.forwardMessage}.
437
+ */
305
438
  async forwardMessage(to, messageId, params) {
306
439
  const chatId = this.#mustGetChatId();
307
440
  return await this.client.forwardMessage(chatId, to, messageId, params);
308
441
  }
442
+ /**
443
+ * Context-aware alias for {@link Client.forwardMessages}.
444
+ */
309
445
  async forwardMessages(to, messageIds, params) {
310
446
  const chatId = this.#mustGetChatId();
311
447
  return await this.client.forwardMessages(chatId, to, messageIds, params);
312
448
  }
449
+ /**
450
+ * Context-aware alias for {@link Client.deleteMessage}.
451
+ */
313
452
  async deleteMessage(messageId, params) {
314
453
  const chatId = this.#mustGetChatId();
315
454
  return await this.client.deleteMessage(chatId, messageId, params);
316
455
  }
456
+ /**
457
+ * Context-aware alias for {@link Client.deleteMessages}.
458
+ */
317
459
  async deleteMessages(messageIds, params) {
318
460
  const chatId = this.#mustGetChatId();
319
461
  return await this.client.deleteMessages(chatId, messageIds, params);
320
462
  }
463
+ /**
464
+ * Context-aware alias for {@link Client.pinMessage}.
465
+ */
321
466
  async pinMessage(messageId, params) {
322
467
  const chatId = this.#mustGetChatId();
323
468
  return await this.client.pinMessage(chatId, messageId, params);
324
469
  }
470
+ /**
471
+ * Context-aware alias for {@link Client.unpinMessage}.
472
+ */
325
473
  async unpinMessage(messageId) {
326
474
  const chatId = this.#mustGetChatId();
327
475
  return await this.client.unpinMessage(chatId, messageId);
328
476
  }
477
+ /**
478
+ * Context-aware alias for {@link Client.unpinMessages}.
479
+ */
329
480
  async unpinMessages() {
330
481
  const chatId = this.#mustGetChatId();
331
482
  return await this.client.unpinMessages(chatId);
332
483
  }
484
+ /**
485
+ * Context-aware alias for {@link Client.setAvailableReactions}.
486
+ */
333
487
  async setAvailableReactions(availableReactions) {
334
488
  const chatId = this.#mustGetChatId();
335
489
  return await this.client.setAvailableReactions(chatId, availableReactions);
336
490
  }
491
+ /**
492
+ * Context-aware alias for {@link Client.addReaction}.
493
+ */
337
494
  async addReaction(messageId, reaction, params) {
338
495
  const chatId = this.#mustGetChatId();
339
496
  return await this.client.addReaction(chatId, messageId, reaction, params);
340
497
  }
498
+ /**
499
+ * Context-aware alias for {@link Client.removeReaction}.
500
+ */
341
501
  async removeReaction(messageId, reaction) {
342
502
  const chatId = this.#mustGetChatId();
343
503
  return await this.client.removeReaction(chatId, messageId, reaction);
344
504
  }
505
+ /**
506
+ * Context-aware alias for {@link Client.setReactions}.
507
+ */
345
508
  async setReactions(messageId, reactions, params) {
346
509
  const chatId = this.#mustGetChatId();
347
510
  return await this.client.setReactions(chatId, messageId, reactions, params);
348
511
  }
512
+ /**
513
+ * Context-aware alias for {@link Client.readMessages}.
514
+ */
349
515
  async read() {
350
516
  const { chatId, messageId } = this.#mustGetMsg();
351
517
  return await this.client.readMessages(chatId, messageId);
352
518
  }
519
+ /**
520
+ * Context-aware alias for {@link Client.setChatPhoto}.
521
+ */
353
522
  async setChatPhoto(photo, params) {
354
523
  const chatId = this.#mustGetChatId();
355
524
  return await this.client.setChatPhoto(chatId, photo, params);
356
525
  }
526
+ /**
527
+ * Context-aware alias for {@link Client.deleteChatPhoto}.
528
+ */
357
529
  async deletChatPhoto() {
358
530
  const chatId = this.#mustGetChatId();
359
531
  return await this.client.deleteChatPhoto(chatId);
360
532
  }
533
+ /**
534
+ * Context-aware alias for {@link Client.banChatMember}.
535
+ */
361
536
  async banChatMember(memberId, params) {
362
537
  const chatId = this.#mustGetChatId();
363
538
  return await this.client.banChatMember(chatId, memberId, params);
364
539
  }
540
+ /**
541
+ * Context-aware alias for {@link Client.unbanChatMember}.
542
+ */
365
543
  async unbanChatMember(memberId) {
366
544
  const chatId = this.#mustGetChatId();
367
545
  return await this.client.unbanChatMember(chatId, memberId);
368
546
  }
547
+ /**
548
+ * Context-aware alias for {@link Client.kickChatMember}.
549
+ */
369
550
  async kickChatMember(memberId) {
370
551
  const chatId = this.#mustGetChatId();
371
552
  return await this.client.kickChatMember(chatId, memberId);
372
553
  }
554
+ /**
555
+ * Context-aware alias for {@link Client.setChatMemberRights}.
556
+ */
373
557
  async setChatMemberRights(memberId, params) {
374
558
  const chatId = this.#mustGetChatId();
375
559
  return await this.client.setChatMemberRights(chatId, memberId, params);
376
560
  }
561
+ /**
562
+ * Context-aware alias for {@link Client.promoteChatMember}.
563
+ */
377
564
  async promoteChatMember(userId, params) {
378
565
  const chatId = this.#mustGetChatId();
379
566
  return await this.client.promoteChatMember(chatId, userId, params);
380
567
  }
568
+ /**
569
+ * Context-aware alias for {@link Client.deleteChatMemberMessages}.
570
+ */
381
571
  async deleteChatMemberMessages(userId) {
382
572
  const chatId = this.#mustGetChatId();
383
573
  return await this.client.deleteChatMemberMessages(chatId, userId);
384
574
  }
575
+ /**
576
+ * Context-aware alias for {@link Client.searchMessages}.
577
+ */
385
578
  async searchMessages(params) {
386
579
  const chatId = this.#mustGetChatId();
387
580
  params ??= {};
388
581
  params.chatId = chatId;
389
582
  return await this.client.searchMessages(params);
390
583
  }
584
+ /**
585
+ * Context-aware alias for {@link Client.setBoostsRequiredToCircumventRestrictions}.
586
+ */
391
587
  async setBoostsRequiredToCircumventRestrictions(boosts) {
392
588
  const chatId = this.#mustGetChatId();
393
589
  return await this.client.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
394
590
  }
591
+ /**
592
+ * Context-aware alias for {@link Client.createInviteLink}.
593
+ */
395
594
  async createInviteLink(params) {
396
595
  const chatId = this.#mustGetChatId();
397
596
  return await this.client.createInviteLink(chatId, params);
398
597
  }
598
+ /**
599
+ * Context-aware alias for {@link Client.getCreatedInviteLinks}.
600
+ */
399
601
  async getCreatedInviteLinks(params) {
400
602
  const chatId = this.#mustGetChatId();
401
603
  return await this.client.getCreatedInviteLinks(chatId, params);
402
604
  }
605
+ /**
606
+ * Context-aware alias for {@link Client.leaveChat}.
607
+ */
403
608
  async leaveChat() {
404
609
  const chatId = this.#mustGetChatId();
405
610
  return await this.client.leaveChat(chatId);
406
611
  }
612
+ /**
613
+ * Context-aware alias for {@link Client.blockUser}.
614
+ */
407
615
  async blockUser() {
408
616
  return await this.client.blockUser(this.#mustGetUserId());
409
617
  }
618
+ /**
619
+ * Context-aware alias for {@link Client.unblockUser}.
620
+ */
410
621
  async unblockUser() {
411
622
  return await this.client.unblockUser(this.#mustGetUserId());
412
623
  }
624
+ /**
625
+ * Context-aware alias for {@link Client.getChatMember}.
626
+ */
413
627
  async getChatMember(userId) {
414
628
  const chatId = this.#mustGetChatId();
415
629
  return await this.client.getChatMember(chatId, userId);
416
630
  }
631
+ /**
632
+ * Context-aware alias for {@link Client.getChatMembers}.
633
+ */
417
634
  async getChatMembers(params) {
418
635
  const chatId = this.#mustGetChatId();
419
636
  return await this.client.getChatMembers(chatId, params);
420
637
  }
638
+ /**
639
+ * Context-aware alias for {@link Client.setChatStickerSet}.
640
+ */
421
641
  async setChatStickerSet(setName) {
422
642
  const chatId = this.#mustGetChatId();
423
643
  return await this.client.setChatStickerSet(chatId, setName);
424
644
  }
645
+ /**
646
+ * Context-aware alias for {@link Client.deleteChatStickerSet}.
647
+ */
425
648
  async deleteChatStickerSet() {
426
649
  const chatId = this.#mustGetChatId();
427
650
  return await this.client.deleteChatStickerSet(chatId);
428
651
  }
652
+ /**
653
+ * Context-aware alias for {@link Client.getBusinessConnection}.
654
+ */
429
655
  async getBusinessConnection() {
430
656
  const { businessConnectionId } = this.#mustGetMsg();
431
657
  if (!businessConnectionId) {
@@ -433,12 +659,18 @@ class Context {
433
659
  }
434
660
  return await this.client.getBusinessConnection(businessConnectionId);
435
661
  }
662
+ /**
663
+ * Context-aware alias for {@link Client.answerPreCheckoutQuery}.
664
+ */
436
665
  async answerPreCheckoutQuery(ok, params) {
437
666
  if (!("preCheckoutQuery" in this.update)) {
438
667
  (0, _0_deps_js_1.unreachable)();
439
668
  }
440
669
  return await this.client.answerPreCheckoutQuery(this.update.preCheckoutQuery.id, ok, params);
441
670
  }
671
+ /**
672
+ * Context-aware alias for {@link Client.approveJoinRequest}.
673
+ */
442
674
  async approveJoinRequest() {
443
675
  const { chatId, userId } = this.#mustGetMsg();
444
676
  if (!userId) {
@@ -446,6 +678,9 @@ class Context {
446
678
  }
447
679
  return await this.client.approveJoinRequest(chatId, userId);
448
680
  }
681
+ /**
682
+ * Context-aware alias for {@link Client.declineJoinRequest}.
683
+ */
449
684
  async declineJoinRequest() {
450
685
  const { chatId, userId } = this.#mustGetMsg();
451
686
  if (!userId) {
@@ -17,14 +17,14 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import type { ClientGeneric } from "./1_client_generic.js";
21
- import type { Api } from "../2_tl.js";
22
- import type { BotCommand, BotTokenCheckResult, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatAction, ChatListItem, ChatMember, ChatP, ChatPChannel, ChatPGroup, ChatPSupergroup, ChatSettings, ClaimedGifts, CodeCheckResult, FailedInvitation, FileSource, Gift, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputMedia, InputStoryContent, InviteLink, JoinRequest, LinkPreview, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageInvoice, MessageLocation, MessagePhoto, MessagePoll, MessageReactionList, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, MiniAppInfo, NetworkStatistics, ParseMode, PasswordCheckResult, Poll, PriceTag, Reaction, SavedChats, SlowModeDuration, Sticker, StickerSet, Story, Topic, Translation, User, VideoChat, VideoChatActive, VideoChatScheduled, VoiceTranscription } from "../3_types.js";
23
- import type { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateChannelParams, CreateGroupParams, CreateInviteLinkParams, CreateStoryParams, CreateSupergroupParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamSegmentParams, DownloadParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageTextParams, EditTopicParams, ForwardMessagesParams, GetChatMembersParams, GetChatsParams, GetClaimedGiftsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetLinkPreviewParams, GetMessageReactionsParams, GetMyCommandsParams, GetSavedChatsParams, GetSavedMessagesParams, GetTranslationsParams, JoinVideoChatParams, OpenChatParams, OpenMiniAppParams, PinMessageParams, PromoteChatMemberParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetBirthdayParams, SetChatMemberRightsParams, SetChatPhotoParams, SetEmojiStatusParams, SetLocationParams, SetMyCommandsParams, SetNameColorParams, SetPersonalChannelParams, SetProfileColorParams, SetReactionsParams, SetSignaturesEnabledParams, SignInParams, StartBotParams, StartVideoChatParams, StopPollParams, UnpinMessageParams, UpdateProfileParams } from "./0_params.js";
20
+ import type { Api, Mtproto } from "../2_tl.js";
24
21
  import type { DC } from "../3_transport.js";
22
+ import type { BotCommand, BotTokenCheckResult, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatAction, ChatListItem, ChatMember, ChatP, ChatPChannel, ChatPGroup, ChatPSupergroup, ChatSettings, ClaimedGifts, CodeCheckResult, FailedInvitation, FileSource, Gift, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputMedia, InputStoryContent, InviteLink, JoinRequest, LinkPreview, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageInvoice, MessageLocation, MessagePhoto, MessagePoll, MessageReactionList, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, MiniAppInfo, NetworkStatistics, ParseMode, PasswordCheckResult, Poll, PriceTag, Reaction, SavedChats, SlowModeDuration, Sticker, StickerSet, Story, Topic, Translation, User, VideoChat, VideoChatActive, VideoChatScheduled, VoiceTranscription } from "../3_types.js";
23
+ import type { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateChannelParams, CreateGroupParams, CreateInviteLinkParams, CreateStoryParams, CreateSupergroupParams, CreateTopicParams, DeclineJoinRequestsParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamSegmentParams, DownloadParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageTextParams, EditTopicParams, ForwardMessagesParams, GetChatMembersParams, GetChatsParams, GetClaimedGiftsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetJoinRequestsParams, GetLinkPreviewParams, GetMessageReactionsParams, GetMyCommandsParams, GetSavedChatsParams, GetSavedMessagesParams, GetTranslationsParams, InvokeParams, JoinVideoChatParams, OpenChatParams, OpenMiniAppParams, PinMessageParams, PromoteChatMemberParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendGiftParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetBirthdayParams, SetChatMemberRightsParams, SetChatPhotoParams, SetEmojiStatusParams, SetLocationParams, SetMyCommandsParams, SetNameColorParams, SetPersonalChannelParams, SetProfileColorParams, SetReactionsParams, SetSignaturesEnabledParams, SignInParams, StartBotParams, StartVideoChatParams, StopPollParams, UnpinMessageParams, UpdateProfileParams } from "./0_params.js";
25
24
  import type { WorkerResponse } from "./0_worker_response.js";
26
- import { Composer } from "./4_composer.js";
25
+ import type { ClientGeneric } from "./1_client_generic.js";
27
26
  import type { Context } from "./2_context.js";
27
+ import { Composer } from "./4_composer.js";
28
28
  export interface ClientDispatcherParams {
29
29
  /** The storage provider to use. Defaults to memory storage. */
30
30
  storage?: "memory" | "indexeddb" | "denokv";
@@ -85,6 +85,7 @@ export declare class ClientDispatcher<C extends Context = Context> extends Compo
85
85
  connect(): Promise<void>;
86
86
  disconnect(): Promise<void>;
87
87
  start(params?: SignInParams): Promise<void>;
88
+ invoke<T extends Api.AnyFunction | Mtproto.ping, R = T extends Mtproto.ping ? Mtproto.pong : T extends Api.AnyGenericFunction<infer X> ? Api.ReturnType<X> : T["_"] extends keyof Api.Functions ? Api.ReturnType<T> extends never ? Api.ReturnType<Api.Functions[T["_"]]> : never : never>(function_: T, params?: InvokeParams): Promise<R>;
88
89
  /**
89
90
  * Send a user verification code.
90
91
  *