grammy-tools 1.36.2

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +339 -0
  3. package/out/bot.d.ts +314 -0
  4. package/out/bot.js +669 -0
  5. package/out/composer.d.ts +764 -0
  6. package/out/composer.js +704 -0
  7. package/out/context.d.ts +1618 -0
  8. package/out/context.js +1976 -0
  9. package/out/convenience/constants.d.ts +98 -0
  10. package/out/convenience/constants.js +37 -0
  11. package/out/convenience/frameworks.d.ts +216 -0
  12. package/out/convenience/frameworks.js +370 -0
  13. package/out/convenience/inline_query.d.ts +401 -0
  14. package/out/convenience/inline_query.js +461 -0
  15. package/out/convenience/input_media.d.ts +72 -0
  16. package/out/convenience/input_media.js +82 -0
  17. package/out/convenience/keyboard.d.ts +763 -0
  18. package/out/convenience/keyboard.js +935 -0
  19. package/out/convenience/session.d.ts +345 -0
  20. package/out/convenience/session.js +455 -0
  21. package/out/convenience/webhook.d.ts +59 -0
  22. package/out/convenience/webhook.js +80 -0
  23. package/out/core/api.d.ts +1628 -0
  24. package/out/core/api.js +1907 -0
  25. package/out/core/client.d.ts +180 -0
  26. package/out/core/client.js +226 -0
  27. package/out/core/error.d.ts +53 -0
  28. package/out/core/error.js +87 -0
  29. package/out/core/payload.d.ts +39 -0
  30. package/out/core/payload.js +199 -0
  31. package/out/filter.d.ts +959 -0
  32. package/out/filter.js +378 -0
  33. package/out/mod.d.ts +14 -0
  34. package/out/mod.js +43 -0
  35. package/out/platform.node.d.ts +16 -0
  36. package/out/platform.node.js +43 -0
  37. package/out/shim.node.d.ts +2 -0
  38. package/out/shim.node.js +7 -0
  39. package/out/types.d.ts +1 -0
  40. package/out/types.js +17 -0
  41. package/out/types.node.d.ts +78 -0
  42. package/out/types.node.js +107 -0
  43. package/out/web.d.ts +1 -0
  44. package/out/web.mjs +5172 -0
  45. package/package.json +71 -0
@@ -0,0 +1,959 @@
1
+ import { type Context } from "./context.js";
2
+ import { type Update } from "./types.js";
3
+ type FilterFunction<C extends Context, D extends C> = (ctx: C) => ctx is D;
4
+ /**
5
+ * > This is an advanced function of grammY.
6
+ *
7
+ * Takes a filter query and turns it into a predicate function that can check in
8
+ * constant time whether a given context object satisfies the query. The created
9
+ * predicate can be passed to `bot.filter` and will narrow down the context
10
+ * accordingly.
11
+ *
12
+ * This function is used internally by `bot.on` but exposed for advanced usage
13
+ * like the following.
14
+ * ```ts
15
+ * // Listens for updates except forwards of messages or channel posts
16
+ * bot.drop(matchFilter(':forward_origin'), ctx => { ... })
17
+ * ```
18
+ *
19
+ * Check out the
20
+ * [documentation](https://grammy.dev/ref/core/composer#on)
21
+ * of `bot.on` for examples. In addition, the
22
+ * [website](https://grammy.dev/guide/filter-queries) contains more
23
+ * information about how filter queries work in grammY.
24
+ *
25
+ * @param filter A filter query or an array of filter queries
26
+ */
27
+ export declare function matchFilter<C extends Context, Q extends FilterQuery>(filter: Q | Q[]): FilterFunction<C, Filter<C, Q>>;
28
+ export declare function parse(filter: FilterQuery | FilterQuery[]): string[][];
29
+ export declare function preprocess(filter: string[]): string[][];
30
+ declare const UPDATE_KEYS: {
31
+ readonly message: {
32
+ readonly new_chat_members: {
33
+ readonly me: {};
34
+ readonly is_bot: {};
35
+ readonly is_premium: {};
36
+ readonly added_to_attachment_menu: {};
37
+ };
38
+ readonly left_chat_member: {
39
+ readonly me: {};
40
+ readonly is_bot: {};
41
+ readonly is_premium: {};
42
+ readonly added_to_attachment_menu: {};
43
+ };
44
+ readonly group_chat_created: {};
45
+ readonly supergroup_chat_created: {};
46
+ readonly migrate_to_chat_id: {};
47
+ readonly migrate_from_chat_id: {};
48
+ readonly successful_payment: {};
49
+ readonly refunded_payment: {};
50
+ readonly users_shared: {};
51
+ readonly chat_shared: {};
52
+ readonly connected_website: {};
53
+ readonly write_access_allowed: {};
54
+ readonly passport_data: {};
55
+ readonly boost_added: {};
56
+ readonly forum_topic_created: {};
57
+ readonly forum_topic_edited: {
58
+ readonly name: {};
59
+ readonly icon_custom_emoji_id: {};
60
+ };
61
+ readonly forum_topic_closed: {};
62
+ readonly forum_topic_reopened: {};
63
+ readonly general_forum_topic_hidden: {};
64
+ readonly general_forum_topic_unhidden: {};
65
+ readonly sender_boost_count: {};
66
+ readonly forward_origin: {
67
+ readonly user: {};
68
+ readonly hidden_user: {};
69
+ readonly chat: {};
70
+ readonly channel: {};
71
+ };
72
+ readonly is_topic_message: {};
73
+ readonly is_automatic_forward: {};
74
+ readonly business_connection_id: {};
75
+ readonly text: {};
76
+ readonly animation: {};
77
+ readonly audio: {};
78
+ readonly document: {};
79
+ readonly paid_media: {};
80
+ readonly photo: {};
81
+ readonly sticker: {
82
+ readonly is_video: {};
83
+ readonly is_animated: {};
84
+ readonly premium_animation: {};
85
+ };
86
+ readonly story: {};
87
+ readonly video: {};
88
+ readonly video_note: {};
89
+ readonly voice: {};
90
+ readonly contact: {};
91
+ readonly dice: {};
92
+ readonly game: {};
93
+ readonly poll: {};
94
+ readonly venue: {};
95
+ readonly location: {};
96
+ readonly entities: {
97
+ readonly mention: {};
98
+ readonly hashtag: {};
99
+ readonly cashtag: {};
100
+ readonly bot_command: {};
101
+ readonly url: {};
102
+ readonly email: {};
103
+ readonly phone_number: {};
104
+ readonly bold: {};
105
+ readonly italic: {};
106
+ readonly underline: {};
107
+ readonly strikethrough: {};
108
+ readonly spoiler: {};
109
+ readonly blockquote: {};
110
+ readonly expandable_blockquote: {};
111
+ readonly code: {};
112
+ readonly pre: {};
113
+ readonly text_link: {};
114
+ readonly text_mention: {};
115
+ readonly custom_emoji: {};
116
+ };
117
+ readonly caption_entities: {
118
+ readonly mention: {};
119
+ readonly hashtag: {};
120
+ readonly cashtag: {};
121
+ readonly bot_command: {};
122
+ readonly url: {};
123
+ readonly email: {};
124
+ readonly phone_number: {};
125
+ readonly bold: {};
126
+ readonly italic: {};
127
+ readonly underline: {};
128
+ readonly strikethrough: {};
129
+ readonly spoiler: {};
130
+ readonly blockquote: {};
131
+ readonly expandable_blockquote: {};
132
+ readonly code: {};
133
+ readonly pre: {};
134
+ readonly text_link: {};
135
+ readonly text_mention: {};
136
+ readonly custom_emoji: {};
137
+ };
138
+ readonly caption: {};
139
+ readonly effect_id: {};
140
+ readonly has_media_spoiler: {};
141
+ readonly new_chat_title: {};
142
+ readonly new_chat_photo: {};
143
+ readonly delete_chat_photo: {};
144
+ readonly message_auto_delete_timer_changed: {};
145
+ readonly pinned_message: {};
146
+ readonly invoice: {};
147
+ readonly proximity_alert_triggered: {};
148
+ readonly chat_background_set: {};
149
+ readonly giveaway_created: {};
150
+ readonly giveaway: {
151
+ readonly only_new_members: {};
152
+ readonly has_public_winners: {};
153
+ };
154
+ readonly giveaway_winners: {
155
+ readonly only_new_members: {};
156
+ readonly was_refunded: {};
157
+ };
158
+ readonly giveaway_completed: {};
159
+ readonly video_chat_scheduled: {};
160
+ readonly video_chat_started: {};
161
+ readonly video_chat_ended: {};
162
+ readonly video_chat_participants_invited: {};
163
+ readonly web_app_data: {};
164
+ };
165
+ readonly edited_message: {
166
+ readonly new_chat_members: {
167
+ readonly me: {};
168
+ readonly is_bot: {};
169
+ readonly is_premium: {};
170
+ readonly added_to_attachment_menu: {};
171
+ };
172
+ readonly left_chat_member: {
173
+ readonly me: {};
174
+ readonly is_bot: {};
175
+ readonly is_premium: {};
176
+ readonly added_to_attachment_menu: {};
177
+ };
178
+ readonly group_chat_created: {};
179
+ readonly supergroup_chat_created: {};
180
+ readonly migrate_to_chat_id: {};
181
+ readonly migrate_from_chat_id: {};
182
+ readonly successful_payment: {};
183
+ readonly refunded_payment: {};
184
+ readonly users_shared: {};
185
+ readonly chat_shared: {};
186
+ readonly connected_website: {};
187
+ readonly write_access_allowed: {};
188
+ readonly passport_data: {};
189
+ readonly boost_added: {};
190
+ readonly forum_topic_created: {};
191
+ readonly forum_topic_edited: {
192
+ readonly name: {};
193
+ readonly icon_custom_emoji_id: {};
194
+ };
195
+ readonly forum_topic_closed: {};
196
+ readonly forum_topic_reopened: {};
197
+ readonly general_forum_topic_hidden: {};
198
+ readonly general_forum_topic_unhidden: {};
199
+ readonly sender_boost_count: {};
200
+ readonly forward_origin: {
201
+ readonly user: {};
202
+ readonly hidden_user: {};
203
+ readonly chat: {};
204
+ readonly channel: {};
205
+ };
206
+ readonly is_topic_message: {};
207
+ readonly is_automatic_forward: {};
208
+ readonly business_connection_id: {};
209
+ readonly text: {};
210
+ readonly animation: {};
211
+ readonly audio: {};
212
+ readonly document: {};
213
+ readonly paid_media: {};
214
+ readonly photo: {};
215
+ readonly sticker: {
216
+ readonly is_video: {};
217
+ readonly is_animated: {};
218
+ readonly premium_animation: {};
219
+ };
220
+ readonly story: {};
221
+ readonly video: {};
222
+ readonly video_note: {};
223
+ readonly voice: {};
224
+ readonly contact: {};
225
+ readonly dice: {};
226
+ readonly game: {};
227
+ readonly poll: {};
228
+ readonly venue: {};
229
+ readonly location: {};
230
+ readonly entities: {
231
+ readonly mention: {};
232
+ readonly hashtag: {};
233
+ readonly cashtag: {};
234
+ readonly bot_command: {};
235
+ readonly url: {};
236
+ readonly email: {};
237
+ readonly phone_number: {};
238
+ readonly bold: {};
239
+ readonly italic: {};
240
+ readonly underline: {};
241
+ readonly strikethrough: {};
242
+ readonly spoiler: {};
243
+ readonly blockquote: {};
244
+ readonly expandable_blockquote: {};
245
+ readonly code: {};
246
+ readonly pre: {};
247
+ readonly text_link: {};
248
+ readonly text_mention: {};
249
+ readonly custom_emoji: {};
250
+ };
251
+ readonly caption_entities: {
252
+ readonly mention: {};
253
+ readonly hashtag: {};
254
+ readonly cashtag: {};
255
+ readonly bot_command: {};
256
+ readonly url: {};
257
+ readonly email: {};
258
+ readonly phone_number: {};
259
+ readonly bold: {};
260
+ readonly italic: {};
261
+ readonly underline: {};
262
+ readonly strikethrough: {};
263
+ readonly spoiler: {};
264
+ readonly blockquote: {};
265
+ readonly expandable_blockquote: {};
266
+ readonly code: {};
267
+ readonly pre: {};
268
+ readonly text_link: {};
269
+ readonly text_mention: {};
270
+ readonly custom_emoji: {};
271
+ };
272
+ readonly caption: {};
273
+ readonly effect_id: {};
274
+ readonly has_media_spoiler: {};
275
+ readonly new_chat_title: {};
276
+ readonly new_chat_photo: {};
277
+ readonly delete_chat_photo: {};
278
+ readonly message_auto_delete_timer_changed: {};
279
+ readonly pinned_message: {};
280
+ readonly invoice: {};
281
+ readonly proximity_alert_triggered: {};
282
+ readonly chat_background_set: {};
283
+ readonly giveaway_created: {};
284
+ readonly giveaway: {
285
+ readonly only_new_members: {};
286
+ readonly has_public_winners: {};
287
+ };
288
+ readonly giveaway_winners: {
289
+ readonly only_new_members: {};
290
+ readonly was_refunded: {};
291
+ };
292
+ readonly giveaway_completed: {};
293
+ readonly video_chat_scheduled: {};
294
+ readonly video_chat_started: {};
295
+ readonly video_chat_ended: {};
296
+ readonly video_chat_participants_invited: {};
297
+ readonly web_app_data: {};
298
+ };
299
+ readonly channel_post: {
300
+ readonly channel_chat_created: {};
301
+ readonly forward_origin: {
302
+ readonly user: {};
303
+ readonly hidden_user: {};
304
+ readonly chat: {};
305
+ readonly channel: {};
306
+ };
307
+ readonly is_topic_message: {};
308
+ readonly is_automatic_forward: {};
309
+ readonly business_connection_id: {};
310
+ readonly text: {};
311
+ readonly animation: {};
312
+ readonly audio: {};
313
+ readonly document: {};
314
+ readonly paid_media: {};
315
+ readonly photo: {};
316
+ readonly sticker: {
317
+ readonly is_video: {};
318
+ readonly is_animated: {};
319
+ readonly premium_animation: {};
320
+ };
321
+ readonly story: {};
322
+ readonly video: {};
323
+ readonly video_note: {};
324
+ readonly voice: {};
325
+ readonly contact: {};
326
+ readonly dice: {};
327
+ readonly game: {};
328
+ readonly poll: {};
329
+ readonly venue: {};
330
+ readonly location: {};
331
+ readonly entities: {
332
+ readonly mention: {};
333
+ readonly hashtag: {};
334
+ readonly cashtag: {};
335
+ readonly bot_command: {};
336
+ readonly url: {};
337
+ readonly email: {};
338
+ readonly phone_number: {};
339
+ readonly bold: {};
340
+ readonly italic: {};
341
+ readonly underline: {};
342
+ readonly strikethrough: {};
343
+ readonly spoiler: {};
344
+ readonly blockquote: {};
345
+ readonly expandable_blockquote: {};
346
+ readonly code: {};
347
+ readonly pre: {};
348
+ readonly text_link: {};
349
+ readonly text_mention: {};
350
+ readonly custom_emoji: {};
351
+ };
352
+ readonly caption_entities: {
353
+ readonly mention: {};
354
+ readonly hashtag: {};
355
+ readonly cashtag: {};
356
+ readonly bot_command: {};
357
+ readonly url: {};
358
+ readonly email: {};
359
+ readonly phone_number: {};
360
+ readonly bold: {};
361
+ readonly italic: {};
362
+ readonly underline: {};
363
+ readonly strikethrough: {};
364
+ readonly spoiler: {};
365
+ readonly blockquote: {};
366
+ readonly expandable_blockquote: {};
367
+ readonly code: {};
368
+ readonly pre: {};
369
+ readonly text_link: {};
370
+ readonly text_mention: {};
371
+ readonly custom_emoji: {};
372
+ };
373
+ readonly caption: {};
374
+ readonly effect_id: {};
375
+ readonly has_media_spoiler: {};
376
+ readonly new_chat_title: {};
377
+ readonly new_chat_photo: {};
378
+ readonly delete_chat_photo: {};
379
+ readonly message_auto_delete_timer_changed: {};
380
+ readonly pinned_message: {};
381
+ readonly invoice: {};
382
+ readonly proximity_alert_triggered: {};
383
+ readonly chat_background_set: {};
384
+ readonly giveaway_created: {};
385
+ readonly giveaway: {
386
+ readonly only_new_members: {};
387
+ readonly has_public_winners: {};
388
+ };
389
+ readonly giveaway_winners: {
390
+ readonly only_new_members: {};
391
+ readonly was_refunded: {};
392
+ };
393
+ readonly giveaway_completed: {};
394
+ readonly video_chat_scheduled: {};
395
+ readonly video_chat_started: {};
396
+ readonly video_chat_ended: {};
397
+ readonly video_chat_participants_invited: {};
398
+ readonly web_app_data: {};
399
+ };
400
+ readonly edited_channel_post: {
401
+ readonly channel_chat_created: {};
402
+ readonly forward_origin: {
403
+ readonly user: {};
404
+ readonly hidden_user: {};
405
+ readonly chat: {};
406
+ readonly channel: {};
407
+ };
408
+ readonly is_topic_message: {};
409
+ readonly is_automatic_forward: {};
410
+ readonly business_connection_id: {};
411
+ readonly text: {};
412
+ readonly animation: {};
413
+ readonly audio: {};
414
+ readonly document: {};
415
+ readonly paid_media: {};
416
+ readonly photo: {};
417
+ readonly sticker: {
418
+ readonly is_video: {};
419
+ readonly is_animated: {};
420
+ readonly premium_animation: {};
421
+ };
422
+ readonly story: {};
423
+ readonly video: {};
424
+ readonly video_note: {};
425
+ readonly voice: {};
426
+ readonly contact: {};
427
+ readonly dice: {};
428
+ readonly game: {};
429
+ readonly poll: {};
430
+ readonly venue: {};
431
+ readonly location: {};
432
+ readonly entities: {
433
+ readonly mention: {};
434
+ readonly hashtag: {};
435
+ readonly cashtag: {};
436
+ readonly bot_command: {};
437
+ readonly url: {};
438
+ readonly email: {};
439
+ readonly phone_number: {};
440
+ readonly bold: {};
441
+ readonly italic: {};
442
+ readonly underline: {};
443
+ readonly strikethrough: {};
444
+ readonly spoiler: {};
445
+ readonly blockquote: {};
446
+ readonly expandable_blockquote: {};
447
+ readonly code: {};
448
+ readonly pre: {};
449
+ readonly text_link: {};
450
+ readonly text_mention: {};
451
+ readonly custom_emoji: {};
452
+ };
453
+ readonly caption_entities: {
454
+ readonly mention: {};
455
+ readonly hashtag: {};
456
+ readonly cashtag: {};
457
+ readonly bot_command: {};
458
+ readonly url: {};
459
+ readonly email: {};
460
+ readonly phone_number: {};
461
+ readonly bold: {};
462
+ readonly italic: {};
463
+ readonly underline: {};
464
+ readonly strikethrough: {};
465
+ readonly spoiler: {};
466
+ readonly blockquote: {};
467
+ readonly expandable_blockquote: {};
468
+ readonly code: {};
469
+ readonly pre: {};
470
+ readonly text_link: {};
471
+ readonly text_mention: {};
472
+ readonly custom_emoji: {};
473
+ };
474
+ readonly caption: {};
475
+ readonly effect_id: {};
476
+ readonly has_media_spoiler: {};
477
+ readonly new_chat_title: {};
478
+ readonly new_chat_photo: {};
479
+ readonly delete_chat_photo: {};
480
+ readonly message_auto_delete_timer_changed: {};
481
+ readonly pinned_message: {};
482
+ readonly invoice: {};
483
+ readonly proximity_alert_triggered: {};
484
+ readonly chat_background_set: {};
485
+ readonly giveaway_created: {};
486
+ readonly giveaway: {
487
+ readonly only_new_members: {};
488
+ readonly has_public_winners: {};
489
+ };
490
+ readonly giveaway_winners: {
491
+ readonly only_new_members: {};
492
+ readonly was_refunded: {};
493
+ };
494
+ readonly giveaway_completed: {};
495
+ readonly video_chat_scheduled: {};
496
+ readonly video_chat_started: {};
497
+ readonly video_chat_ended: {};
498
+ readonly video_chat_participants_invited: {};
499
+ readonly web_app_data: {};
500
+ };
501
+ readonly business_connection: {
502
+ readonly can_reply: {};
503
+ readonly is_enabled: {};
504
+ };
505
+ readonly business_message: {
506
+ readonly new_chat_members: {
507
+ readonly me: {};
508
+ readonly is_bot: {};
509
+ readonly is_premium: {};
510
+ readonly added_to_attachment_menu: {};
511
+ };
512
+ readonly left_chat_member: {
513
+ readonly me: {};
514
+ readonly is_bot: {};
515
+ readonly is_premium: {};
516
+ readonly added_to_attachment_menu: {};
517
+ };
518
+ readonly group_chat_created: {};
519
+ readonly supergroup_chat_created: {};
520
+ readonly migrate_to_chat_id: {};
521
+ readonly migrate_from_chat_id: {};
522
+ readonly successful_payment: {};
523
+ readonly refunded_payment: {};
524
+ readonly users_shared: {};
525
+ readonly chat_shared: {};
526
+ readonly connected_website: {};
527
+ readonly write_access_allowed: {};
528
+ readonly passport_data: {};
529
+ readonly boost_added: {};
530
+ readonly forum_topic_created: {};
531
+ readonly forum_topic_edited: {
532
+ readonly name: {};
533
+ readonly icon_custom_emoji_id: {};
534
+ };
535
+ readonly forum_topic_closed: {};
536
+ readonly forum_topic_reopened: {};
537
+ readonly general_forum_topic_hidden: {};
538
+ readonly general_forum_topic_unhidden: {};
539
+ readonly sender_boost_count: {};
540
+ readonly forward_origin: {
541
+ readonly user: {};
542
+ readonly hidden_user: {};
543
+ readonly chat: {};
544
+ readonly channel: {};
545
+ };
546
+ readonly is_topic_message: {};
547
+ readonly is_automatic_forward: {};
548
+ readonly business_connection_id: {};
549
+ readonly text: {};
550
+ readonly animation: {};
551
+ readonly audio: {};
552
+ readonly document: {};
553
+ readonly paid_media: {};
554
+ readonly photo: {};
555
+ readonly sticker: {
556
+ readonly is_video: {};
557
+ readonly is_animated: {};
558
+ readonly premium_animation: {};
559
+ };
560
+ readonly story: {};
561
+ readonly video: {};
562
+ readonly video_note: {};
563
+ readonly voice: {};
564
+ readonly contact: {};
565
+ readonly dice: {};
566
+ readonly game: {};
567
+ readonly poll: {};
568
+ readonly venue: {};
569
+ readonly location: {};
570
+ readonly entities: {
571
+ readonly mention: {};
572
+ readonly hashtag: {};
573
+ readonly cashtag: {};
574
+ readonly bot_command: {};
575
+ readonly url: {};
576
+ readonly email: {};
577
+ readonly phone_number: {};
578
+ readonly bold: {};
579
+ readonly italic: {};
580
+ readonly underline: {};
581
+ readonly strikethrough: {};
582
+ readonly spoiler: {};
583
+ readonly blockquote: {};
584
+ readonly expandable_blockquote: {};
585
+ readonly code: {};
586
+ readonly pre: {};
587
+ readonly text_link: {};
588
+ readonly text_mention: {};
589
+ readonly custom_emoji: {};
590
+ };
591
+ readonly caption_entities: {
592
+ readonly mention: {};
593
+ readonly hashtag: {};
594
+ readonly cashtag: {};
595
+ readonly bot_command: {};
596
+ readonly url: {};
597
+ readonly email: {};
598
+ readonly phone_number: {};
599
+ readonly bold: {};
600
+ readonly italic: {};
601
+ readonly underline: {};
602
+ readonly strikethrough: {};
603
+ readonly spoiler: {};
604
+ readonly blockquote: {};
605
+ readonly expandable_blockquote: {};
606
+ readonly code: {};
607
+ readonly pre: {};
608
+ readonly text_link: {};
609
+ readonly text_mention: {};
610
+ readonly custom_emoji: {};
611
+ };
612
+ readonly caption: {};
613
+ readonly effect_id: {};
614
+ readonly has_media_spoiler: {};
615
+ readonly new_chat_title: {};
616
+ readonly new_chat_photo: {};
617
+ readonly delete_chat_photo: {};
618
+ readonly message_auto_delete_timer_changed: {};
619
+ readonly pinned_message: {};
620
+ readonly invoice: {};
621
+ readonly proximity_alert_triggered: {};
622
+ readonly chat_background_set: {};
623
+ readonly giveaway_created: {};
624
+ readonly giveaway: {
625
+ readonly only_new_members: {};
626
+ readonly has_public_winners: {};
627
+ };
628
+ readonly giveaway_winners: {
629
+ readonly only_new_members: {};
630
+ readonly was_refunded: {};
631
+ };
632
+ readonly giveaway_completed: {};
633
+ readonly video_chat_scheduled: {};
634
+ readonly video_chat_started: {};
635
+ readonly video_chat_ended: {};
636
+ readonly video_chat_participants_invited: {};
637
+ readonly web_app_data: {};
638
+ };
639
+ readonly edited_business_message: {
640
+ readonly new_chat_members: {
641
+ readonly me: {};
642
+ readonly is_bot: {};
643
+ readonly is_premium: {};
644
+ readonly added_to_attachment_menu: {};
645
+ };
646
+ readonly left_chat_member: {
647
+ readonly me: {};
648
+ readonly is_bot: {};
649
+ readonly is_premium: {};
650
+ readonly added_to_attachment_menu: {};
651
+ };
652
+ readonly group_chat_created: {};
653
+ readonly supergroup_chat_created: {};
654
+ readonly migrate_to_chat_id: {};
655
+ readonly migrate_from_chat_id: {};
656
+ readonly successful_payment: {};
657
+ readonly refunded_payment: {};
658
+ readonly users_shared: {};
659
+ readonly chat_shared: {};
660
+ readonly connected_website: {};
661
+ readonly write_access_allowed: {};
662
+ readonly passport_data: {};
663
+ readonly boost_added: {};
664
+ readonly forum_topic_created: {};
665
+ readonly forum_topic_edited: {
666
+ readonly name: {};
667
+ readonly icon_custom_emoji_id: {};
668
+ };
669
+ readonly forum_topic_closed: {};
670
+ readonly forum_topic_reopened: {};
671
+ readonly general_forum_topic_hidden: {};
672
+ readonly general_forum_topic_unhidden: {};
673
+ readonly sender_boost_count: {};
674
+ readonly forward_origin: {
675
+ readonly user: {};
676
+ readonly hidden_user: {};
677
+ readonly chat: {};
678
+ readonly channel: {};
679
+ };
680
+ readonly is_topic_message: {};
681
+ readonly is_automatic_forward: {};
682
+ readonly business_connection_id: {};
683
+ readonly text: {};
684
+ readonly animation: {};
685
+ readonly audio: {};
686
+ readonly document: {};
687
+ readonly paid_media: {};
688
+ readonly photo: {};
689
+ readonly sticker: {
690
+ readonly is_video: {};
691
+ readonly is_animated: {};
692
+ readonly premium_animation: {};
693
+ };
694
+ readonly story: {};
695
+ readonly video: {};
696
+ readonly video_note: {};
697
+ readonly voice: {};
698
+ readonly contact: {};
699
+ readonly dice: {};
700
+ readonly game: {};
701
+ readonly poll: {};
702
+ readonly venue: {};
703
+ readonly location: {};
704
+ readonly entities: {
705
+ readonly mention: {};
706
+ readonly hashtag: {};
707
+ readonly cashtag: {};
708
+ readonly bot_command: {};
709
+ readonly url: {};
710
+ readonly email: {};
711
+ readonly phone_number: {};
712
+ readonly bold: {};
713
+ readonly italic: {};
714
+ readonly underline: {};
715
+ readonly strikethrough: {};
716
+ readonly spoiler: {};
717
+ readonly blockquote: {};
718
+ readonly expandable_blockquote: {};
719
+ readonly code: {};
720
+ readonly pre: {};
721
+ readonly text_link: {};
722
+ readonly text_mention: {};
723
+ readonly custom_emoji: {};
724
+ };
725
+ readonly caption_entities: {
726
+ readonly mention: {};
727
+ readonly hashtag: {};
728
+ readonly cashtag: {};
729
+ readonly bot_command: {};
730
+ readonly url: {};
731
+ readonly email: {};
732
+ readonly phone_number: {};
733
+ readonly bold: {};
734
+ readonly italic: {};
735
+ readonly underline: {};
736
+ readonly strikethrough: {};
737
+ readonly spoiler: {};
738
+ readonly blockquote: {};
739
+ readonly expandable_blockquote: {};
740
+ readonly code: {};
741
+ readonly pre: {};
742
+ readonly text_link: {};
743
+ readonly text_mention: {};
744
+ readonly custom_emoji: {};
745
+ };
746
+ readonly caption: {};
747
+ readonly effect_id: {};
748
+ readonly has_media_spoiler: {};
749
+ readonly new_chat_title: {};
750
+ readonly new_chat_photo: {};
751
+ readonly delete_chat_photo: {};
752
+ readonly message_auto_delete_timer_changed: {};
753
+ readonly pinned_message: {};
754
+ readonly invoice: {};
755
+ readonly proximity_alert_triggered: {};
756
+ readonly chat_background_set: {};
757
+ readonly giveaway_created: {};
758
+ readonly giveaway: {
759
+ readonly only_new_members: {};
760
+ readonly has_public_winners: {};
761
+ };
762
+ readonly giveaway_winners: {
763
+ readonly only_new_members: {};
764
+ readonly was_refunded: {};
765
+ };
766
+ readonly giveaway_completed: {};
767
+ readonly video_chat_scheduled: {};
768
+ readonly video_chat_started: {};
769
+ readonly video_chat_ended: {};
770
+ readonly video_chat_participants_invited: {};
771
+ readonly web_app_data: {};
772
+ };
773
+ readonly deleted_business_messages: {};
774
+ readonly inline_query: {};
775
+ readonly chosen_inline_result: {};
776
+ readonly callback_query: {
777
+ readonly data: {};
778
+ readonly game_short_name: {};
779
+ };
780
+ readonly shipping_query: {};
781
+ readonly pre_checkout_query: {};
782
+ readonly poll: {};
783
+ readonly poll_answer: {};
784
+ readonly my_chat_member: {
785
+ readonly from: {
786
+ readonly me: {};
787
+ readonly is_bot: {};
788
+ readonly is_premium: {};
789
+ readonly added_to_attachment_menu: {};
790
+ };
791
+ };
792
+ readonly chat_member: {
793
+ readonly from: {
794
+ readonly me: {};
795
+ readonly is_bot: {};
796
+ readonly is_premium: {};
797
+ readonly added_to_attachment_menu: {};
798
+ };
799
+ };
800
+ readonly chat_join_request: {};
801
+ readonly message_reaction: {
802
+ readonly old_reaction: {
803
+ readonly emoji: {};
804
+ readonly custom_emoji: {};
805
+ readonly paid: {};
806
+ };
807
+ readonly new_reaction: {
808
+ readonly emoji: {};
809
+ readonly custom_emoji: {};
810
+ readonly paid: {};
811
+ };
812
+ };
813
+ readonly message_reaction_count: {
814
+ readonly reactions: {
815
+ readonly emoji: {};
816
+ readonly custom_emoji: {};
817
+ readonly paid: {};
818
+ };
819
+ };
820
+ readonly chat_boost: {};
821
+ readonly removed_chat_boost: {};
822
+ readonly purchased_paid_media: {};
823
+ };
824
+ type KeyOf<T> = string & keyof T;
825
+ type S = typeof UPDATE_KEYS;
826
+ type L1S = KeyOf<S>;
827
+ type L2S<L1 extends L1S = L1S> = L1 extends unknown ? `${L1}:${KeyOf<S[L1]>}` : never;
828
+ type L3S<L1 extends L1S = L1S> = L1 extends unknown ? L3S_<L1> : never;
829
+ type L3S_<L1 extends L1S, L2 extends KeyOf<S[L1]> = KeyOf<S[L1]>> = L2 extends unknown ? `${L1}:${L2}:${KeyOf<S[L1][L2]>}` : never;
830
+ type L123 = L1S | L2S | L3S;
831
+ type InjectShortcuts<Q extends L123 = L123> = Q extends `${infer L1}:${infer L2}:${infer L3}` ? `${CollapseL1<L1, L1Shortcuts>}:${CollapseL2<L2, L2Shortcuts>}:${L3}` : Q extends `${infer L1}:${infer L2}` ? `${CollapseL1<L1, L1Shortcuts>}:${CollapseL2<L2>}` : CollapseL1<Q>;
832
+ type CollapseL1<Q extends string, L extends L1Shortcuts = Exclude<L1Shortcuts, "">> = Q | (L extends string ? Q extends typeof L1_SHORTCUTS[L][number] ? L : never : never);
833
+ type CollapseL2<Q extends string, L extends L2Shortcuts = Exclude<L2Shortcuts, "">> = Q | (L extends string ? Q extends typeof L2_SHORTCUTS[L][number] ? L : never : never);
834
+ type ComputeFilterQueryList = InjectShortcuts;
835
+ /**
836
+ * Represents a filter query that can be passed to `bot.on`. There are three
837
+ * different kinds of filter queries: Level 1, Level 2, and Level 3. Check out
838
+ * the [website](https://grammy.dev/guide/filter-queries) to read about how
839
+ * filter queries work in grammY, and how to use them.
840
+ *
841
+ * Here are three brief examples:
842
+ * ```ts
843
+ * // Listen for messages of any type (Level 1)
844
+ * bot.on('message', ctx => { ... })
845
+ * // Listen for audio messages only (Level 2)
846
+ * bot.on('message:audio', ctx => { ... })
847
+ * // Listen for text messages that have a URL entity (Level 3)
848
+ * bot.on('message:entities:url', ctx => { ... })
849
+ * ```
850
+ */
851
+ export type FilterQuery = ComputeFilterQueryList;
852
+ /**
853
+ * Any kind of value that appears in the Telegram Bot API. When intersected with
854
+ * an optional field, it effectively removes `| undefined`.
855
+ */
856
+ type NotUndefined = {};
857
+ /**
858
+ * Given a FilterQuery, returns an object that, when intersected with an Update,
859
+ * marks those properties as required that are guaranteed to exist.
860
+ */
861
+ type RunQuery<Q extends string> = L1Discriminator<Q, L1Parts<Q>>;
862
+ type L1Parts<Q extends string> = Q extends `${infer L1}:${string}` ? L1 : Q;
863
+ type L2Parts<Q extends string, L1 extends string> = Q extends `${L1}:${infer L2}:${string}` ? L2 : Q extends `${L1}:${infer L2}` ? L2 : never;
864
+ type L1Discriminator<Q extends string, L1 extends string> = Combine<L1Fragment<Q, L1>, L1>;
865
+ type L1Fragment<Q extends string, L1 extends string> = L1 extends unknown ? Record<L1, L2Discriminator<L1, L2Parts<Q, L1>>> : never;
866
+ type L2Discriminator<L1 extends string, L2 extends string> = [L2] extends [
867
+ never
868
+ ] ? L2ShallowFragment<L1> : Combine<L2Fragment<L1, L2>, L2>;
869
+ type L2Fragment<L1 extends string, L2 extends string> = L2 extends unknown ? Record<L2 | AddTwins<L1, L2>, NotUndefined> : never;
870
+ type L2ShallowFragment<L1 extends string> = Record<AddTwins<L1, never>, NotUndefined>;
871
+ type Combine<U, K extends string> = U extends unknown ? U & Partial<Record<Exclude<K, keyof U>, undefined>> : never;
872
+ /**
873
+ * This type infers which properties will be present on the given context object
874
+ * provided it matches the given filter query. If the filter query is a union
875
+ * type, the produced context object will be a union of possible combinations,
876
+ * hence allowing you to narrow down manually which of the properties are
877
+ * present.
878
+ *
879
+ * In some sense, this type computes `matchFilter` on the type level.
880
+ */
881
+ export type Filter<C extends Context, Q extends FilterQuery> = PerformQuery<C, RunQuery<ExpandShortcuts<Q>>>;
882
+ export type FilterCore<Q extends FilterQuery> = PerformQueryCore<RunQuery<ExpandShortcuts<Q>>>;
883
+ type PerformQuery<C extends Context, U extends object> = U extends unknown ? FilteredContext<C, Update & U> : never;
884
+ type PerformQueryCore<U extends object> = U extends unknown ? FilteredContextCore<Update & U> : never;
885
+ type FilteredContext<C extends Context, U extends Update> = C & FilteredContextCore<U>;
886
+ type FilteredContextCore<U extends Update> = Record<"update", U> & Shortcuts<U>;
887
+ interface Shortcuts<U extends Update> {
888
+ message: [U["message"]] extends [object] ? U["message"] : undefined;
889
+ editedMessage: [U["edited_message"]] extends [object] ? U["edited_message"] : undefined;
890
+ channelPost: [U["channel_post"]] extends [object] ? U["channel_post"] : undefined;
891
+ editedChannelPost: [U["edited_channel_post"]] extends [object] ? U["edited_channel_post"] : undefined;
892
+ businessConnection: [U["business_connection"]] extends [object] ? U["business_connection"] : undefined;
893
+ businessMessage: [U["business_message"]] extends [object] ? U["business_message"] : undefined;
894
+ editedBusinessMessage: [U["edited_business_message"]] extends [object] ? U["edited_business_message"] : undefined;
895
+ deletedBusinessMessages: [U["deleted_business_messages"]] extends [object] ? U["deleted_business_messages"] : undefined;
896
+ messageReaction: [U["message_reaction"]] extends [object] ? U["message_reaction"] : undefined;
897
+ messageReactionCount: [U["message_reaction_count"]] extends [object] ? U["message_reaction_count"] : undefined;
898
+ inlineQuery: [U["inline_query"]] extends [object] ? U["inline_query"] : undefined;
899
+ chosenInlineResult: [U["chosen_inline_result"]] extends [object] ? U["chosen_inline_result"] : undefined;
900
+ callbackQuery: [U["callback_query"]] extends [object] ? U["callback_query"] : undefined;
901
+ shippingQuery: [U["shipping_query"]] extends [object] ? U["shipping_query"] : undefined;
902
+ preCheckoutQuery: [U["pre_checkout_query"]] extends [object] ? U["pre_checkout_query"] : undefined;
903
+ poll: [U["poll"]] extends [object] ? U["poll"] : undefined;
904
+ pollAnswer: [U["poll_answer"]] extends [object] ? U["poll_answer"] : undefined;
905
+ myChatMember: [U["my_chat_member"]] extends [object] ? U["my_chat_member"] : undefined;
906
+ chatMember: [U["chat_member"]] extends [object] ? U["chat_member"] : undefined;
907
+ chatJoinRequest: [U["chat_join_request"]] extends [object] ? U["chat_join_request"] : undefined;
908
+ chatBoost: [U["chat_boost"]] extends [object] ? U["chat_boost"] : undefined;
909
+ removedChatBoost: [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"] : undefined;
910
+ purchasedPaidMedia: [U["purchased_paid_media"]] extends [object] ? U["purchased_paid_media"] : undefined;
911
+ msg: [U["message"]] extends [object] ? U["message"] : [U["edited_message"]] extends [object] ? U["edited_message"] : [U["channel_post"]] extends [object] ? U["channel_post"] : [U["edited_channel_post"]] extends [object] ? U["edited_channel_post"] : [U["business_message"]] extends [object] ? U["business_message"] : [U["edited_business_message"]] extends [object] ? U["edited_business_message"] : [U["callback_query"]] extends [object] ? U["callback_query"]["message"] : undefined;
912
+ chat: [U["callback_query"]] extends [object] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["chat"] : [U["deleted_business_messages"]] extends [object] ? U["deleted_business_messages"]["chat"] : [U["message_reaction"]] extends [object] ? U["message_reaction"]["chat"] : [U["message_reaction_count"]] extends [object] ? U["message_reaction_count"]["chat"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [object] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["chat"] : [U["chat_boost"]] extends [object] ? U["chat_boost"]["chat"] : [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"]["chat"] : undefined;
913
+ senderChat: [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["sender_chat"] : undefined;
914
+ from: [U["business_connection"]] extends [object] ? U["business_connection"]["user"] : [U["message_reaction"]] extends [object] ? U["message_reaction"]["user"] : [U["chat_boost"]] extends [object] ? U["chat_boost"]["boost"]["source"]["user"] : [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"]["source"]["user"] : [U["callback_query"]] extends [object] ? U["callback_query"]["from"] : [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["from"] : [U["inline_query"]] extends [object] ? U["inline_query"]["from"] : [U["chosen_inline_result"]] extends [object] ? U["chosen_inline_result"]["from"] : [U["shipping_query"]] extends [object] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [object] ? U["pre_checkout_query"]["from"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [object] ? U["chat_member"]["from"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["from"] : undefined;
915
+ msgId: [U["callback_query"]] extends [object] ? number | undefined : [Shortcuts<U>["msg"]] extends [object] ? number : [U["message_reaction"]] extends [object] ? number : [U["message_reaction_count"]] extends [object] ? number : undefined;
916
+ chatId: [U["callback_query"]] extends [object] ? number | undefined : [Shortcuts<U>["chat"]] extends [object] ? number : [U["business_connection"]] extends [object] ? number : undefined;
917
+ businessConnectionId: [U["callback_query"]] extends [object] ? string | undefined : [Shortcuts<U>["msg"]] extends [object] ? string | undefined : [U["business_connection"]] extends [object] ? string : [U["deleted_business_messages"]] extends [object] ? string : undefined;
918
+ }
919
+ declare const L1_SHORTCUTS: {
920
+ readonly "": readonly ["message", "channel_post"];
921
+ readonly msg: readonly ["message", "channel_post"];
922
+ readonly edit: readonly ["edited_message", "edited_channel_post"];
923
+ };
924
+ declare const L2_SHORTCUTS: {
925
+ readonly "": readonly ["entities", "caption_entities"];
926
+ readonly media: readonly ["photo", "video"];
927
+ readonly file: readonly ["photo", "animation", "audio", "document", "video", "video_note", "voice", "sticker"];
928
+ };
929
+ type L1Shortcuts = KeyOf<typeof L1_SHORTCUTS>;
930
+ type L2Shortcuts = KeyOf<typeof L2_SHORTCUTS>;
931
+ type ExpandShortcuts<Q extends string> = Q extends `${infer L1}:${infer L2}:${infer L3}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}:${L3}` : Q extends `${infer L1}:${infer L2}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}` : ExpandL1<Q>;
932
+ type ExpandL1<S extends string> = S extends L1Shortcuts ? typeof L1_SHORTCUTS[S][number] : S;
933
+ type ExpandL2<S extends string> = S extends L2Shortcuts ? typeof L2_SHORTCUTS[S][number] : S;
934
+ type AddTwins<L1 extends string, L2 extends string> = TwinsFromL1<L1, L2> | TwinsFromL2<L1, L2>;
935
+ type TwinsFromL1<L1 extends string, L2 extends string> = L1 extends KeyOf<L1Equivalents> ? L1Equivalents[L1] : L2;
936
+ type L1Equivalents = {
937
+ message: "from";
938
+ edited_message: "from" | "edit_date";
939
+ channel_post: "sender_chat";
940
+ edited_channel_post: "sender_chat" | "edit_date";
941
+ business_message: "from";
942
+ edited_business_message: "from" | "edit_date";
943
+ };
944
+ type TwinsFromL2<L1 extends string, L2 extends string> = L1 extends KeyOf<L2Equivalents> ? L2 extends KeyOf<L2Equivalents[L1]> ? L2Equivalents[L1][L2] : L2 : L2;
945
+ type L2Equivalents = {
946
+ message: MessageEquivalents;
947
+ edited_message: MessageEquivalents;
948
+ channel_post: MessageEquivalents;
949
+ edited_channel_post: MessageEquivalents;
950
+ business_message: MessageEquivalents;
951
+ edited_business_message: MessageEquivalents;
952
+ };
953
+ type MessageEquivalents = {
954
+ animation: "document";
955
+ entities: "text";
956
+ caption_entities: "caption";
957
+ is_topic_message: "message_thread_id";
958
+ };
959
+ export {};