@mtkruto/node 0.0.998 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_deps.d.ts +1 -1
- package/esm/0_deps.js +1 -1
- package/esm/3_errors.d.ts +1531 -0
- package/esm/3_errors.js +1531 -0
- package/esm/3_types.d.ts +39 -3
- package/esm/3_types.js +39 -3
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/4_errors.d.ts +25 -0
- package/esm/4_errors.js +64 -0
- package/esm/client/2_client_plain.js +1 -1
- package/esm/client/3_types.d.ts +1 -5
- package/esm/client/4_client.d.ts +20 -3
- package/esm/client/4_client.js +61 -62
- package/esm/connection/1_connection_web_socket.js +2 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.d.ts +2 -2
- package/esm/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.js +19 -6
- package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.d.ts +2 -0
- package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +991 -0
- package/esm/mod.d.ts +3 -2
- package/esm/mod.js +3 -2
- package/esm/tl/2_types.d.ts +1 -1
- package/esm/tl/2_types.js +1 -2
- package/esm/tl/3_functions.d.ts +1 -1
- package/esm/tl/3_functions.js +1 -2
- package/esm/types/{!0_file_id.js → 0__file_id.js} +0 -1
- package/esm/types/0_bot_command.d.ts +4 -0
- package/esm/types/0_chat_id.d.ts +4 -0
- package/esm/types/0_chat_id.js +1 -0
- package/esm/types/0_chat_photo.js +1 -1
- package/esm/types/0_input_contact_message_content.d.ts +6 -0
- package/esm/types/0_input_contact_message_content.js +1 -0
- package/esm/types/0_input_location_message_content.d.ts +8 -0
- package/esm/types/0_input_location_message_content.js +1 -0
- package/esm/types/0_input_venue_message_content.d.ts +10 -0
- package/esm/types/0_input_venue_message_content.js +1 -0
- package/esm/types/0_labeled_price.d.ts +4 -0
- package/esm/types/0_labeled_price.js +1 -0
- package/esm/types/0_parse_mode.d.ts +1 -0
- package/esm/types/0_parse_mode.js +1 -0
- package/esm/types/0_thumbnail.js +1 -1
- package/esm/types/{!0_misc.d.ts → 1__getters.d.ts} +7 -0
- package/esm/types/1__getters.js +1 -0
- package/esm/types/1_bot_command_scope.d.ts +32 -0
- package/esm/types/1_bot_command_scope.js +27 -0
- package/esm/types/1_chat.d.ts +1 -1
- package/esm/types/1_chat.js +1 -1
- package/esm/types/1_inline_query_result_button.d.ts +6 -0
- package/esm/types/1_inline_query_result_button.js +1 -0
- package/esm/types/1_input_invoice_message_content.d.ts +23 -0
- package/esm/types/1_input_invoice_message_content.js +1 -0
- package/esm/types/1_input_text_message_content.d.ts +8 -0
- package/esm/types/1_input_text_message_content.js +1 -0
- package/esm/types/1_photo.js +1 -1
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_sticker.js +1 -1
- package/esm/types/1_user.d.ts +1 -1
- package/esm/types/1_user.js +1 -1
- package/esm/types/2_game.js +1 -1
- package/{script/types/1_inline_keyboard_button.d.ts → esm/types/2_inline_keyboard_button.d.ts} +3 -3
- package/esm/types/2_inline_query.d.ts +1 -1
- package/esm/types/2_input_message_content.d.ts +6 -0
- package/esm/types/2_input_message_content.js +1 -0
- package/esm/types/{2_inline_keyboard_markup.d.ts → 3_inline_keyboard_markup.d.ts} +3 -2
- package/esm/types/{2_inline_keyboard_markup.js → 3_inline_keyboard_markup.js} +1 -1
- package/esm/types/3_message.d.ts +13 -13
- package/esm/types/3_message.js +13 -13
- package/esm/types/4_callback_query.d.ts +1 -1
- package/esm/types/4_inline_query_result_article.d.ts +15 -0
- package/esm/types/4_inline_query_result_article.js +1 -0
- package/esm/types/4_inline_query_result_audio.d.ts +17 -0
- package/esm/types/4_inline_query_result_audio.js +1 -0
- package/esm/types/4_inline_query_result_cached_audio.d.ts +14 -0
- package/esm/types/4_inline_query_result_cached_audio.js +1 -0
- package/esm/types/4_inline_query_result_cached_document.d.ts +15 -0
- package/esm/types/4_inline_query_result_cached_document.js +1 -0
- package/esm/types/4_inline_query_result_cached_gif.d.ts +15 -0
- package/esm/types/4_inline_query_result_cached_gif.js +1 -0
- package/esm/types/4_inline_query_result_cached_mpeg4_gif.d.ts +15 -0
- package/esm/types/4_inline_query_result_cached_mpeg4_gif.js +1 -0
- package/esm/types/4_inline_query_result_cached_photo.d.ts +16 -0
- package/esm/types/4_inline_query_result_cached_photo.js +1 -0
- package/esm/types/4_inline_query_result_cached_sticker.d.ts +9 -0
- package/esm/types/4_inline_query_result_cached_sticker.js +1 -0
- package/esm/types/4_inline_query_result_cached_video.d.ts +16 -0
- package/esm/types/4_inline_query_result_cached_video.js +1 -0
- package/esm/types/4_inline_query_result_cached_voice.d.ts +15 -0
- package/esm/types/4_inline_query_result_cached_voice.js +1 -0
- package/esm/types/4_inline_query_result_contact.d.ts +15 -0
- package/esm/types/4_inline_query_result_contact.js +1 -0
- package/esm/types/4_inline_query_result_document.d.ts +18 -0
- package/esm/types/4_inline_query_result_document.js +1 -0
- package/esm/types/4_inline_query_result_game.d.ts +7 -0
- package/esm/types/4_inline_query_result_game.js +1 -0
- package/esm/types/4_inline_query_result_gif.d.ts +20 -0
- package/esm/types/4_inline_query_result_gif.js +1 -0
- package/esm/types/4_inline_query_result_location.d.ts +18 -0
- package/esm/types/4_inline_query_result_location.js +1 -0
- package/esm/types/4_inline_query_result_mpeg4_gif.d.ts +20 -0
- package/esm/types/4_inline_query_result_mpeg4_gif.js +1 -0
- package/esm/types/4_inline_query_result_photo.d.ts +19 -0
- package/esm/types/4_inline_query_result_photo.js +1 -0
- package/esm/types/4_inline_query_result_venue.d.ts +19 -0
- package/esm/types/4_inline_query_result_venue.js +1 -0
- package/esm/types/4_inline_query_result_video.d.ts +21 -0
- package/esm/types/4_inline_query_result_video.js +1 -0
- package/esm/types/4_inline_query_result_voice.d.ts +16 -0
- package/esm/types/4_inline_query_result_voice.js +1 -0
- package/esm/types/4_reply_markup.d.ts +7 -0
- package/esm/types/4_reply_markup.js +22 -0
- package/esm/types/5_inline_query_result.d.ts +29 -0
- package/esm/types/5_inline_query_result.js +256 -0
- package/esm/utilities/0_crypto.js +6 -4
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -1
- package/script/0_deps.js +1 -1
- package/script/3_errors.d.ts +1531 -0
- package/script/3_errors.js +2053 -0
- package/script/3_types.d.ts +39 -3
- package/script/3_types.js +39 -3
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/4_errors.d.ts +25 -0
- package/script/4_errors.js +88 -0
- package/script/client/2_client_plain.js +1 -1
- package/script/client/3_types.d.ts +1 -5
- package/script/client/4_client.d.ts +20 -3
- package/script/client/4_client.js +60 -61
- package/script/connection/1_connection_web_socket.js +2 -1
- package/script/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.d.ts +2 -2
- package/script/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.js +19 -6
- package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.d.ts +2 -0
- package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +993 -0
- package/script/mod.d.ts +3 -2
- package/script/mod.js +16 -3
- package/script/tl/2_types.d.ts +1 -1
- package/script/tl/2_types.js +0 -1
- package/script/tl/3_functions.d.ts +1 -1
- package/script/tl/3_functions.js +0 -1
- package/script/types/{!0_file_id.js → 0__file_id.js} +0 -1
- package/script/types/0_bot_command.d.ts +4 -0
- package/script/types/0_chat_id.d.ts +4 -0
- package/script/types/0_chat_id.js +2 -0
- package/script/types/0_chat_photo.js +7 -7
- package/script/types/0_input_contact_message_content.d.ts +6 -0
- package/script/types/0_input_contact_message_content.js +2 -0
- package/script/types/0_input_location_message_content.d.ts +8 -0
- package/script/types/0_input_location_message_content.js +2 -0
- package/script/types/0_input_venue_message_content.d.ts +10 -0
- package/script/types/0_input_venue_message_content.js +2 -0
- package/script/types/0_labeled_price.d.ts +4 -0
- package/script/types/0_labeled_price.js +2 -0
- package/script/types/0_parse_mode.d.ts +1 -0
- package/script/types/0_parse_mode.js +2 -0
- package/script/types/0_thumbnail.js +5 -5
- package/script/types/{!0_misc.d.ts → 1__getters.d.ts} +7 -0
- package/script/types/1__getters.js +2 -0
- package/script/types/1_bot_command_scope.d.ts +32 -0
- package/script/types/1_bot_command_scope.js +31 -0
- package/script/types/1_chat.d.ts +1 -1
- package/script/types/1_chat.js +1 -1
- package/script/types/1_inline_query_result_button.d.ts +6 -0
- package/script/types/1_inline_query_result_button.js +2 -0
- package/script/types/1_input_invoice_message_content.d.ts +23 -0
- package/script/types/1_input_invoice_message_content.js +2 -0
- package/script/types/1_input_text_message_content.d.ts +8 -0
- package/script/types/1_input_text_message_content.js +2 -0
- package/script/types/1_photo.js +5 -5
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_sticker.js +1 -1
- package/script/types/1_user.d.ts +1 -1
- package/script/types/1_user.js +1 -1
- package/script/types/2_game.js +3 -3
- package/{esm/types/1_inline_keyboard_button.d.ts → script/types/2_inline_keyboard_button.d.ts} +3 -3
- package/script/types/2_inline_query.d.ts +1 -1
- package/script/types/2_input_message_content.d.ts +6 -0
- package/script/types/2_input_message_content.js +2 -0
- package/script/types/{2_inline_keyboard_markup.d.ts → 3_inline_keyboard_markup.d.ts} +3 -2
- package/script/types/{2_inline_keyboard_markup.js → 3_inline_keyboard_markup.js} +3 -3
- package/script/types/3_message.d.ts +13 -13
- package/script/types/3_message.js +23 -23
- package/script/types/4_callback_query.d.ts +1 -1
- package/script/types/4_inline_query_result_article.d.ts +15 -0
- package/script/types/4_inline_query_result_article.js +2 -0
- package/script/types/4_inline_query_result_audio.d.ts +17 -0
- package/script/types/4_inline_query_result_audio.js +2 -0
- package/script/types/4_inline_query_result_cached_audio.d.ts +14 -0
- package/script/types/4_inline_query_result_cached_audio.js +2 -0
- package/script/types/4_inline_query_result_cached_document.d.ts +15 -0
- package/script/types/4_inline_query_result_cached_document.js +2 -0
- package/script/types/4_inline_query_result_cached_gif.d.ts +15 -0
- package/script/types/4_inline_query_result_cached_gif.js +2 -0
- package/script/types/4_inline_query_result_cached_mpeg4_gif.d.ts +15 -0
- package/script/types/4_inline_query_result_cached_mpeg4_gif.js +2 -0
- package/script/types/4_inline_query_result_cached_photo.d.ts +16 -0
- package/script/types/4_inline_query_result_cached_photo.js +2 -0
- package/script/types/4_inline_query_result_cached_sticker.d.ts +9 -0
- package/script/types/4_inline_query_result_cached_sticker.js +2 -0
- package/script/types/4_inline_query_result_cached_video.d.ts +16 -0
- package/script/types/4_inline_query_result_cached_video.js +2 -0
- package/script/types/4_inline_query_result_cached_voice.d.ts +15 -0
- package/script/types/4_inline_query_result_cached_voice.js +2 -0
- package/script/types/4_inline_query_result_contact.d.ts +15 -0
- package/script/types/4_inline_query_result_contact.js +2 -0
- package/script/types/4_inline_query_result_document.d.ts +18 -0
- package/script/types/4_inline_query_result_document.js +2 -0
- package/script/types/4_inline_query_result_game.d.ts +7 -0
- package/script/types/4_inline_query_result_game.js +2 -0
- package/script/types/4_inline_query_result_gif.d.ts +20 -0
- package/script/types/4_inline_query_result_gif.js +2 -0
- package/script/types/4_inline_query_result_location.d.ts +18 -0
- package/script/types/4_inline_query_result_location.js +2 -0
- package/script/types/4_inline_query_result_mpeg4_gif.d.ts +20 -0
- package/script/types/4_inline_query_result_mpeg4_gif.js +2 -0
- package/script/types/4_inline_query_result_photo.d.ts +19 -0
- package/script/types/4_inline_query_result_photo.js +2 -0
- package/script/types/4_inline_query_result_venue.d.ts +19 -0
- package/script/types/4_inline_query_result_venue.js +2 -0
- package/script/types/4_inline_query_result_video.d.ts +21 -0
- package/script/types/4_inline_query_result_video.js +2 -0
- package/script/types/4_inline_query_result_voice.d.ts +16 -0
- package/script/types/4_inline_query_result_voice.js +2 -0
- package/script/types/4_reply_markup.d.ts +7 -0
- package/script/types/4_reply_markup.js +26 -0
- package/script/types/5_inline_query_result.d.ts +29 -0
- package/script/types/5_inline_query_result.js +260 -0
- package/script/utilities/0_crypto.js +6 -4
- package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
- package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1078
- package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
- package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1080
- /package/esm/types/{!0_file_id.d.ts → 0__file_id.d.ts} +0 -0
- /package/esm/types/{!0_misc.js → 0_bot_command.js} +0 -0
- /package/esm/types/{1_inline_keyboard_button.js → 2_inline_keyboard_button.js} +0 -0
- /package/script/types/{!0_file_id.d.ts → 0__file_id.d.ts} +0 -0
- /package/script/types/{!0_misc.js → 0_bot_command.js} +0 -0
- /package/script/types/{1_inline_keyboard_button.js → 2_inline_keyboard_button.js} +0 -0
package/esm/3_types.d.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
export * from "./types/!0_file_id.js";
|
|
2
1
|
export * from "./types/0_audio.js";
|
|
2
|
+
export * from "./types/0_bot_command.js";
|
|
3
3
|
export * from "./types/0_chat_action.js";
|
|
4
4
|
export * from "./types/0_chat_administrator_rights.js";
|
|
5
|
+
export * from "./types/0_chat_id.js";
|
|
5
6
|
export * from "./types/0_chat_photo.js";
|
|
7
|
+
export * from "./types/0_color.js";
|
|
6
8
|
export * from "./types/0_contact.js";
|
|
7
9
|
export * from "./types/0_dice.js";
|
|
10
|
+
export * from "./types/0__file_id.js";
|
|
8
11
|
export * from "./types/0_force_reply.js";
|
|
12
|
+
export * from "./types/0_input_contact_message_content.js";
|
|
13
|
+
export * from "./types/0_input_location_message_content.js";
|
|
14
|
+
export * from "./types/0_input_venue_message_content.js";
|
|
9
15
|
export * from "./types/0_keyboard_button_poll_type.js";
|
|
16
|
+
export * from "./types/0_labeled_price.js";
|
|
10
17
|
export * from "./types/0_location.js";
|
|
11
18
|
export * from "./types/0_login_url.js";
|
|
12
19
|
export * from "./types/0_mask_position.js";
|
|
13
20
|
export * from "./types/0_message_entity.js";
|
|
21
|
+
export * from "./types/0_parse_mode.js";
|
|
14
22
|
export * from "./types/0_poll_option.js";
|
|
15
23
|
export * from "./types/0_reply_keyboard_remove.js";
|
|
16
24
|
export * from "./types/0_thumbnail.js";
|
|
@@ -18,9 +26,13 @@ export * from "./types/0_venue.js";
|
|
|
18
26
|
export * from "./types/0_voice.js";
|
|
19
27
|
export * from "./types/0_web_app_info.js";
|
|
20
28
|
export * from "./types/1_animation.js";
|
|
29
|
+
export * from "./types/1_bot_command_scope.js";
|
|
21
30
|
export * from "./types/1_chat.js";
|
|
22
31
|
export * from "./types/1_document.js";
|
|
23
|
-
export * from "./types/
|
|
32
|
+
export * from "./types/1__getters.js";
|
|
33
|
+
export * from "./types/1_inline_query_result_button.js";
|
|
34
|
+
export * from "./types/1_input_invoice_message_content.js";
|
|
35
|
+
export * from "./types/1_input_text_message_content.js";
|
|
24
36
|
export * from "./types/1_keyboard_button.js";
|
|
25
37
|
export * from "./types/1_photo.js";
|
|
26
38
|
export * from "./types/1_poll.js";
|
|
@@ -29,8 +41,32 @@ export * from "./types/1_user.js";
|
|
|
29
41
|
export * from "./types/1_video_note.js";
|
|
30
42
|
export * from "./types/1_video.js";
|
|
31
43
|
export * from "./types/2_game.js";
|
|
32
|
-
export * from "./types/
|
|
44
|
+
export * from "./types/2_inline_keyboard_button.js";
|
|
33
45
|
export * from "./types/2_inline_query.js";
|
|
46
|
+
export * from "./types/2_input_message_content.js";
|
|
34
47
|
export * from "./types/2_reply_keyboard_markup.js";
|
|
48
|
+
export * from "./types/3_inline_keyboard_markup.js";
|
|
35
49
|
export * from "./types/3_message.js";
|
|
36
50
|
export * from "./types/4_callback_query.js";
|
|
51
|
+
export * from "./types/4_inline_query_result_article.js";
|
|
52
|
+
export * from "./types/4_inline_query_result_audio.js";
|
|
53
|
+
export * from "./types/4_inline_query_result_cached_audio.js";
|
|
54
|
+
export * from "./types/4_inline_query_result_cached_document.js";
|
|
55
|
+
export * from "./types/4_inline_query_result_cached_gif.js";
|
|
56
|
+
export * from "./types/4_inline_query_result_cached_mpeg4_gif.js";
|
|
57
|
+
export * from "./types/4_inline_query_result_cached_photo.js";
|
|
58
|
+
export * from "./types/4_inline_query_result_cached_sticker.js";
|
|
59
|
+
export * from "./types/4_inline_query_result_cached_video.js";
|
|
60
|
+
export * from "./types/4_inline_query_result_cached_voice.js";
|
|
61
|
+
export * from "./types/4_inline_query_result_contact.js";
|
|
62
|
+
export * from "./types/4_inline_query_result_document.js";
|
|
63
|
+
export * from "./types/4_inline_query_result_game.js";
|
|
64
|
+
export * from "./types/4_inline_query_result_gif.js";
|
|
65
|
+
export * from "./types/4_inline_query_result_location.js";
|
|
66
|
+
export * from "./types/4_inline_query_result_mpeg4_gif.js";
|
|
67
|
+
export * from "./types/4_inline_query_result_photo.js";
|
|
68
|
+
export * from "./types/4_inline_query_result_venue.js";
|
|
69
|
+
export * from "./types/4_inline_query_result_video.js";
|
|
70
|
+
export * from "./types/4_inline_query_result_voice.js";
|
|
71
|
+
export * from "./types/4_reply_markup.js";
|
|
72
|
+
export * from "./types/5_inline_query_result.js";
|
package/esm/3_types.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
export * from "./types/!0_file_id.js";
|
|
2
1
|
export * from "./types/0_audio.js";
|
|
2
|
+
export * from "./types/0_bot_command.js";
|
|
3
3
|
export * from "./types/0_chat_action.js";
|
|
4
4
|
export * from "./types/0_chat_administrator_rights.js";
|
|
5
|
+
export * from "./types/0_chat_id.js";
|
|
5
6
|
export * from "./types/0_chat_photo.js";
|
|
7
|
+
export * from "./types/0_color.js";
|
|
6
8
|
export * from "./types/0_contact.js";
|
|
7
9
|
export * from "./types/0_dice.js";
|
|
10
|
+
export * from "./types/0__file_id.js";
|
|
8
11
|
export * from "./types/0_force_reply.js";
|
|
12
|
+
export * from "./types/0_input_contact_message_content.js";
|
|
13
|
+
export * from "./types/0_input_location_message_content.js";
|
|
14
|
+
export * from "./types/0_input_venue_message_content.js";
|
|
9
15
|
export * from "./types/0_keyboard_button_poll_type.js";
|
|
16
|
+
export * from "./types/0_labeled_price.js";
|
|
10
17
|
export * from "./types/0_location.js";
|
|
11
18
|
export * from "./types/0_login_url.js";
|
|
12
19
|
export * from "./types/0_mask_position.js";
|
|
13
20
|
export * from "./types/0_message_entity.js";
|
|
21
|
+
export * from "./types/0_parse_mode.js";
|
|
14
22
|
export * from "./types/0_poll_option.js";
|
|
15
23
|
export * from "./types/0_reply_keyboard_remove.js";
|
|
16
24
|
export * from "./types/0_thumbnail.js";
|
|
@@ -18,9 +26,13 @@ export * from "./types/0_venue.js";
|
|
|
18
26
|
export * from "./types/0_voice.js";
|
|
19
27
|
export * from "./types/0_web_app_info.js";
|
|
20
28
|
export * from "./types/1_animation.js";
|
|
29
|
+
export * from "./types/1_bot_command_scope.js";
|
|
21
30
|
export * from "./types/1_chat.js";
|
|
22
31
|
export * from "./types/1_document.js";
|
|
23
|
-
export * from "./types/
|
|
32
|
+
export * from "./types/1__getters.js";
|
|
33
|
+
export * from "./types/1_inline_query_result_button.js";
|
|
34
|
+
export * from "./types/1_input_invoice_message_content.js";
|
|
35
|
+
export * from "./types/1_input_text_message_content.js";
|
|
24
36
|
export * from "./types/1_keyboard_button.js";
|
|
25
37
|
export * from "./types/1_photo.js";
|
|
26
38
|
export * from "./types/1_poll.js";
|
|
@@ -29,8 +41,32 @@ export * from "./types/1_user.js";
|
|
|
29
41
|
export * from "./types/1_video_note.js";
|
|
30
42
|
export * from "./types/1_video.js";
|
|
31
43
|
export * from "./types/2_game.js";
|
|
32
|
-
export * from "./types/
|
|
44
|
+
export * from "./types/2_inline_keyboard_button.js";
|
|
33
45
|
export * from "./types/2_inline_query.js";
|
|
46
|
+
export * from "./types/2_input_message_content.js";
|
|
34
47
|
export * from "./types/2_reply_keyboard_markup.js";
|
|
48
|
+
export * from "./types/3_inline_keyboard_markup.js";
|
|
35
49
|
export * from "./types/3_message.js";
|
|
36
50
|
export * from "./types/4_callback_query.js";
|
|
51
|
+
export * from "./types/4_inline_query_result_article.js";
|
|
52
|
+
export * from "./types/4_inline_query_result_audio.js";
|
|
53
|
+
export * from "./types/4_inline_query_result_cached_audio.js";
|
|
54
|
+
export * from "./types/4_inline_query_result_cached_document.js";
|
|
55
|
+
export * from "./types/4_inline_query_result_cached_gif.js";
|
|
56
|
+
export * from "./types/4_inline_query_result_cached_mpeg4_gif.js";
|
|
57
|
+
export * from "./types/4_inline_query_result_cached_photo.js";
|
|
58
|
+
export * from "./types/4_inline_query_result_cached_sticker.js";
|
|
59
|
+
export * from "./types/4_inline_query_result_cached_video.js";
|
|
60
|
+
export * from "./types/4_inline_query_result_cached_voice.js";
|
|
61
|
+
export * from "./types/4_inline_query_result_contact.js";
|
|
62
|
+
export * from "./types/4_inline_query_result_document.js";
|
|
63
|
+
export * from "./types/4_inline_query_result_game.js";
|
|
64
|
+
export * from "./types/4_inline_query_result_gif.js";
|
|
65
|
+
export * from "./types/4_inline_query_result_location.js";
|
|
66
|
+
export * from "./types/4_inline_query_result_mpeg4_gif.js";
|
|
67
|
+
export * from "./types/4_inline_query_result_photo.js";
|
|
68
|
+
export * from "./types/4_inline_query_result_venue.js";
|
|
69
|
+
export * from "./types/4_inline_query_result_video.js";
|
|
70
|
+
export * from "./types/4_inline_query_result_voice.js";
|
|
71
|
+
export * from "./types/4_reply_markup.js";
|
|
72
|
+
export * from "./types/5_inline_query_result.js";
|
package/esm/4_constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
|
|
|
5
5
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
6
6
|
export declare const INITIAL_DC: DC;
|
|
7
7
|
export declare const LAYER = 161;
|
|
8
|
-
export declare const APP_VERSION = "MTKruto 0.0
|
|
8
|
+
export declare const APP_VERSION = "MTKruto 0.1.0";
|
|
9
9
|
export declare const DEVICE_MODEL: string;
|
|
10
10
|
export declare const LANG_CODE: string;
|
|
11
11
|
export declare const LANG_PACK = "";
|
package/esm/4_constants.js
CHANGED
|
@@ -54,7 +54,7 @@ export const PUBLIC_KEYS = Object.freeze([
|
|
|
54
54
|
export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
55
55
|
export const INITIAL_DC = "2-test";
|
|
56
56
|
export const LAYER = 161;
|
|
57
|
-
export const APP_VERSION = "MTKruto 0.0
|
|
57
|
+
export const APP_VERSION = "MTKruto 0.1.0";
|
|
58
58
|
// @ts-ignore: lib
|
|
59
59
|
export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
60
60
|
export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { types } from "./2_tl.js";
|
|
2
|
+
export * from "./3_errors.js";
|
|
3
|
+
export declare class FloodWait extends types.RPCError {
|
|
4
|
+
seconds: number;
|
|
5
|
+
constructor(params: {
|
|
6
|
+
errorCode: number;
|
|
7
|
+
errorMessage: string;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export declare class Migrate extends types.RPCError {
|
|
11
|
+
dc: number;
|
|
12
|
+
constructor(params: {
|
|
13
|
+
errorCode: number;
|
|
14
|
+
errorMessage: string;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export declare class UserMigrate extends Migrate {
|
|
18
|
+
}
|
|
19
|
+
export declare class PhoneMigrate extends Migrate {
|
|
20
|
+
}
|
|
21
|
+
export declare class FileMigrate extends Migrate {
|
|
22
|
+
}
|
|
23
|
+
export declare class StatsMigrate extends Migrate {
|
|
24
|
+
}
|
|
25
|
+
export declare function upgradeInstance(error: types.RPCError): types.RPCError;
|
package/esm/4_errors.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { UNREACHABLE } from "./1_utilities.js";
|
|
2
|
+
import { map } from "./3_errors.js";
|
|
3
|
+
import { types } from "./2_tl.js";
|
|
4
|
+
export * from "./3_errors.js";
|
|
5
|
+
export class FloodWait extends types.RPCError {
|
|
6
|
+
constructor(params) {
|
|
7
|
+
super(params);
|
|
8
|
+
Object.defineProperty(this, "seconds", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
const p = params.errorMessage.split("_");
|
|
15
|
+
this.seconds = Number(p[p.length - 1]);
|
|
16
|
+
if (isNaN(this.seconds)) {
|
|
17
|
+
UNREACHABLE();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class Migrate extends types.RPCError {
|
|
22
|
+
constructor(params) {
|
|
23
|
+
super(params);
|
|
24
|
+
Object.defineProperty(this, "dc", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
const p = params.errorMessage.split("_");
|
|
31
|
+
this.dc = Number(p[p.length - 1]);
|
|
32
|
+
if (isNaN(this.dc)) {
|
|
33
|
+
UNREACHABLE();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class UserMigrate extends Migrate {
|
|
38
|
+
}
|
|
39
|
+
export class PhoneMigrate extends Migrate {
|
|
40
|
+
}
|
|
41
|
+
export class FileMigrate extends Migrate {
|
|
42
|
+
}
|
|
43
|
+
export class StatsMigrate extends Migrate {
|
|
44
|
+
}
|
|
45
|
+
const prefixMap = {
|
|
46
|
+
"FILE_MIGRATE_": FileMigrate,
|
|
47
|
+
"PHONE_MIGRATE_": PhoneMigrate,
|
|
48
|
+
"USER_MIGRATE_": UserMigrate,
|
|
49
|
+
"STATS_MIGRATE_": StatsMigrate,
|
|
50
|
+
"FLOOD_WAIT_": FloodWait,
|
|
51
|
+
};
|
|
52
|
+
export function upgradeInstance(error) {
|
|
53
|
+
for (const [k, v] of Object.entries(prefixMap)) {
|
|
54
|
+
if (error.errorMessage.startsWith(k)) {
|
|
55
|
+
return new v(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const [k, v] of Object.entries(map)) {
|
|
59
|
+
if (error.errorMessage == k) {
|
|
60
|
+
return new v(error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return error;
|
|
64
|
+
}
|
|
@@ -2,8 +2,8 @@ import { assertEquals, assertInstanceOf, debug, factorize, ige256Decrypt, ige256
|
|
|
2
2
|
import { bigIntFromBuffer, bufferFromBigInt, concat, getRandomBigInt, modExp, rsaPad, sha1, UNREACHABLE } from "../1_utilities.js";
|
|
3
3
|
import { functions, serialize, TLReader, types } from "../2_tl.js";
|
|
4
4
|
import { PUBLIC_KEYS } from "../4_constants.js";
|
|
5
|
-
import { ClientAbstract } from "./1_client_abstract.js";
|
|
6
5
|
import { getMessageId, packUnencryptedMessage, unpackUnencryptedMessage } from "./0_message.js";
|
|
6
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
7
7
|
const d = debug("ClientPlain/createAuthKey");
|
|
8
8
|
export class ClientPlain extends ClientAbstract {
|
|
9
9
|
constructor(params) {
|
package/esm/client/3_types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
|
-
import { CallbackQuery, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
|
|
2
|
+
import { CallbackQuery, ChatID, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
|
|
3
3
|
import { With } from "./0_utilities.js";
|
|
4
4
|
import { ClientPlainParams } from "./2_client_plain.js";
|
|
5
5
|
export type ParseMode = "HTML" | null;
|
|
@@ -52,10 +52,6 @@ export interface AuthorizeUserParams<S = string> {
|
|
|
52
52
|
code: S | (() => MaybePromise<S>);
|
|
53
53
|
password: S | ((hint: string | null) => MaybePromise<S>);
|
|
54
54
|
}
|
|
55
|
-
/**
|
|
56
|
-
* A chat identifier as provided by MTKruto or a string starting with a @ that is followed by a username.
|
|
57
|
-
*/
|
|
58
|
-
export type ChatID = number | string;
|
|
59
55
|
export interface SendMessagesParams {
|
|
60
56
|
/**
|
|
61
57
|
* The parse mode to use. If not provided, the default parse mode will be used.
|
package/esm/client/4_client.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { MaybePromise } from "../1_utilities.js";
|
|
|
2
2
|
import { functions, ReadObject, types } from "../2_tl.js";
|
|
3
3
|
import { Storage } from "../3_storage.js";
|
|
4
4
|
import { DC } from "../3_transport.js";
|
|
5
|
-
import { ChatAction, Message } from "../3_types.js";
|
|
5
|
+
import { BotCommand, BotCommandScope, ChatAction, ChatID, InlineQueryResult, InlineQueryResultButton, Message } from "../3_types.js";
|
|
6
|
+
import { Migrate } from "../4_errors.js";
|
|
6
7
|
import { With } from "./0_utilities.js";
|
|
7
8
|
import { ClientAbstract } from "./1_client_abstract.js";
|
|
8
|
-
import { AnswerCallbackQueryParams, AuthorizeUserParams,
|
|
9
|
+
import { AnswerCallbackQueryParams, AuthorizeUserParams, ClientParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, Handler, ParseMode, SendMessagesParams, SendPollParams, Update } from "./3_types.js";
|
|
9
10
|
export declare const getEntity: unique symbol;
|
|
10
11
|
export declare const getStickerSetName: unique symbol;
|
|
11
12
|
export declare const handleMigrationError: unique symbol;
|
|
@@ -60,7 +61,7 @@ export declare class Client extends ClientAbstract {
|
|
|
60
61
|
private assertUser;
|
|
61
62
|
private assertBot;
|
|
62
63
|
private fetchState;
|
|
63
|
-
[handleMigrationError](err:
|
|
64
|
+
[handleMigrationError](err: Migrate): Promise<void>;
|
|
64
65
|
private connectionInited;
|
|
65
66
|
disconnect(): Promise<void>;
|
|
66
67
|
private initConnection;
|
|
@@ -192,6 +193,7 @@ export declare class Client extends ClientAbstract {
|
|
|
192
193
|
* @param id ID of the callback query to answer.
|
|
193
194
|
*/
|
|
194
195
|
answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
|
|
196
|
+
private usernameResolver;
|
|
195
197
|
private constructReplyMarkup;
|
|
196
198
|
private static assertMsgHas;
|
|
197
199
|
/**
|
|
@@ -210,6 +212,21 @@ export declare class Client extends ClientAbstract {
|
|
|
210
212
|
* @param messageThreadId The thread to send the chat action to.
|
|
211
213
|
*/
|
|
212
214
|
sendChatAction(chatId: ChatID, action_: ChatAction, messageThreadId?: number): Promise<void>;
|
|
215
|
+
setMyCommands(commands: BotCommand[], params?: {
|
|
216
|
+
languageCode?: string;
|
|
217
|
+
scope?: BotCommandScope;
|
|
218
|
+
}): Promise<void>;
|
|
219
|
+
getMyCommands(params?: {
|
|
220
|
+
languageCode?: string;
|
|
221
|
+
scope?: BotCommandScope;
|
|
222
|
+
}): Promise<BotCommand[]>;
|
|
223
|
+
answerInlineQuery(id: string, results: InlineQueryResult[], params?: {
|
|
224
|
+
cacheTime?: number;
|
|
225
|
+
isPersonal?: boolean;
|
|
226
|
+
nextOffset?: string;
|
|
227
|
+
isGallery?: boolean;
|
|
228
|
+
button: InlineQueryResultButton;
|
|
229
|
+
}): Promise<void>;
|
|
213
230
|
private handle;
|
|
214
231
|
use(handler: Handler): void;
|
|
215
232
|
branch(predicate: (upd: Update) => MaybePromise<boolean>, trueHandler: Handler, falseHandler: Handler): void;
|
package/esm/client/4_client.js
CHANGED
|
@@ -2,14 +2,15 @@ import { debug, gunzip, Mutex } from "../0_deps.js";
|
|
|
2
2
|
import { bigIntFromBuffer, drop, getRandomBigInt, getRandomId, mustPrompt, mustPromptOneOf, Queue, sha1, UNREACHABLE } from "../1_utilities.js";
|
|
3
3
|
import { as, functions, getChannelChatId, Message_, MessageContainer, peerToChatId, RPCResult, TLError, TLReader, types } from "../2_tl.js";
|
|
4
4
|
import { StorageMemory } from "../3_storage.js";
|
|
5
|
-
import { constructCallbackQuery, constructInlineQuery, constructMessage, constructUser, FileID, FileType,
|
|
5
|
+
import { botCommandScopeToTlObject, constructCallbackQuery, constructInlineQuery, constructMessage, constructUser, FileID, FileType, inlineQueryResultToTlObject, messageEntityToTlObject, replyMarkupToTlObject, ThumbnailSource } from "../3_types.js";
|
|
6
6
|
import { ACK_THRESHOLD, APP_VERSION, CHANNEL_DIFFERENCE_LIMIT_BOT, CHANNEL_DIFFERENCE_LIMIT_USER, DEVICE_MODEL, LANG_CODE, LANG_PACK, LAYER, MAX_CHANNEL_ID, MAX_CHAT_ID, STICKER_SET_NAME_TTL, SYSTEM_LANG_CODE, SYSTEM_VERSION, USERNAME_TTL, ZERO_CHANNEL_ID } from "../4_constants.js";
|
|
7
|
-
import {
|
|
7
|
+
import { AuthKeyUnregistered, Migrate, PasswordHashInvalid, PhoneNumberInvalid, SessionPasswordNeeded, upgradeInstance } from "../4_errors.js";
|
|
8
|
+
import { parseHtml } from "./0_html.js";
|
|
8
9
|
import { decryptMessage, encryptMessage, getMessageId } from "./0_message.js";
|
|
9
10
|
import { checkPassword } from "./0_password.js";
|
|
10
|
-
import {
|
|
11
|
-
import { ClientPlain } from "./2_client_plain.js";
|
|
11
|
+
import { isChannelPtsUpdate, isPtsUpdate, resolve } from "./0_utilities.js";
|
|
12
12
|
import { ClientAbstract } from "./1_client_abstract.js";
|
|
13
|
+
import { ClientPlain } from "./2_client_plain.js";
|
|
13
14
|
import { skip } from "./3_types.js";
|
|
14
15
|
const d = debug("Client");
|
|
15
16
|
const dGap = debug("Client/recoverUpdateGap");
|
|
@@ -212,6 +213,15 @@ export class Client extends ClientAbstract {
|
|
|
212
213
|
writable: true,
|
|
213
214
|
value: new Queue("processUpdates")
|
|
214
215
|
});
|
|
216
|
+
Object.defineProperty(this, "usernameResolver", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
configurable: true,
|
|
219
|
+
writable: true,
|
|
220
|
+
value: async (v) => {
|
|
221
|
+
const inputPeer = await this.getInputPeer(v).then((v) => v[as](types.InputPeerUser));
|
|
222
|
+
return new types.InputUser({ userId: inputPeer.userId, accessHash: inputPeer.accessHash });
|
|
223
|
+
}
|
|
224
|
+
});
|
|
215
225
|
Object.defineProperty(this, "handle", {
|
|
216
226
|
enumerable: true,
|
|
217
227
|
configurable: true,
|
|
@@ -318,18 +328,12 @@ export class Client extends ClientAbstract {
|
|
|
318
328
|
d("state fetched [%s]", source);
|
|
319
329
|
}
|
|
320
330
|
async [handleMigrationError](err) {
|
|
321
|
-
|
|
322
|
-
if (
|
|
323
|
-
|
|
324
|
-
if (Math.abs(this.dcId) >= 10000) {
|
|
325
|
-
newDc += "-test";
|
|
326
|
-
}
|
|
327
|
-
await this.reconnect(newDc);
|
|
328
|
-
d("migrated to DC%s", newDc);
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
UNREACHABLE();
|
|
331
|
+
let newDc = String(err.dc);
|
|
332
|
+
if (Math.abs(this.dcId) >= 10000) {
|
|
333
|
+
newDc += "-test";
|
|
332
334
|
}
|
|
335
|
+
await this.reconnect(newDc);
|
|
336
|
+
d("migrated to DC%s", newDc);
|
|
333
337
|
}
|
|
334
338
|
disconnect() {
|
|
335
339
|
this.connectionInited = false;
|
|
@@ -402,7 +406,7 @@ export class Client extends ClientAbstract {
|
|
|
402
406
|
return;
|
|
403
407
|
}
|
|
404
408
|
catch (err) {
|
|
405
|
-
if (!(err instanceof
|
|
409
|
+
if (!(err instanceof AuthKeyUnregistered)) {
|
|
406
410
|
throw err;
|
|
407
411
|
}
|
|
408
412
|
}
|
|
@@ -414,16 +418,10 @@ export class Client extends ClientAbstract {
|
|
|
414
418
|
break;
|
|
415
419
|
}
|
|
416
420
|
catch (err) {
|
|
417
|
-
if (err instanceof
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
await this.initConnection();
|
|
422
|
-
continue;
|
|
423
|
-
}
|
|
424
|
-
else {
|
|
425
|
-
throw err;
|
|
426
|
-
}
|
|
421
|
+
if (err instanceof Migrate) {
|
|
422
|
+
await this[handleMigrationError](err);
|
|
423
|
+
await this.initConnection();
|
|
424
|
+
continue;
|
|
427
425
|
}
|
|
428
426
|
else {
|
|
429
427
|
throw err;
|
|
@@ -455,16 +453,10 @@ export class Client extends ClientAbstract {
|
|
|
455
453
|
sentCode = await sendCode();
|
|
456
454
|
}
|
|
457
455
|
catch (err) {
|
|
458
|
-
if (err instanceof
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
await this.initConnection();
|
|
463
|
-
sentCode = await sendCode();
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
throw err;
|
|
467
|
-
}
|
|
456
|
+
if (err instanceof Migrate) {
|
|
457
|
+
await this[handleMigrationError](err);
|
|
458
|
+
await this.initConnection();
|
|
459
|
+
sentCode = await sendCode();
|
|
468
460
|
}
|
|
469
461
|
else {
|
|
470
462
|
throw err;
|
|
@@ -473,7 +465,7 @@ export class Client extends ClientAbstract {
|
|
|
473
465
|
break;
|
|
474
466
|
}
|
|
475
467
|
catch (err) {
|
|
476
|
-
if (err instanceof
|
|
468
|
+
if (err instanceof PhoneNumberInvalid) {
|
|
477
469
|
continue;
|
|
478
470
|
}
|
|
479
471
|
else {
|
|
@@ -507,7 +499,7 @@ export class Client extends ClientAbstract {
|
|
|
507
499
|
}
|
|
508
500
|
}
|
|
509
501
|
}
|
|
510
|
-
if (!(err instanceof
|
|
502
|
+
if (!(err instanceof SessionPasswordNeeded)) {
|
|
511
503
|
throw err;
|
|
512
504
|
}
|
|
513
505
|
while (true) {
|
|
@@ -526,7 +518,7 @@ export class Client extends ClientAbstract {
|
|
|
526
518
|
break;
|
|
527
519
|
}
|
|
528
520
|
catch (err) {
|
|
529
|
-
if (err instanceof
|
|
521
|
+
if (err instanceof PasswordHashInvalid) {
|
|
530
522
|
continue;
|
|
531
523
|
}
|
|
532
524
|
else {
|
|
@@ -548,7 +540,7 @@ export class Client extends ClientAbstract {
|
|
|
548
540
|
return;
|
|
549
541
|
}
|
|
550
542
|
catch (err) {
|
|
551
|
-
if (!(err instanceof
|
|
543
|
+
if (!(err instanceof AuthKeyUnregistered)) {
|
|
552
544
|
throw err;
|
|
553
545
|
}
|
|
554
546
|
}
|
|
@@ -600,7 +592,7 @@ export class Client extends ClientAbstract {
|
|
|
600
592
|
const promise = this.promises.get(messageId);
|
|
601
593
|
if (promise) {
|
|
602
594
|
if (result instanceof types.RPCError) {
|
|
603
|
-
promise.reject(result);
|
|
595
|
+
promise.reject(upgradeInstance(result));
|
|
604
596
|
}
|
|
605
597
|
else {
|
|
606
598
|
promise.resolve(result);
|
|
@@ -694,7 +686,7 @@ export class Client extends ClientAbstract {
|
|
|
694
686
|
});
|
|
695
687
|
}
|
|
696
688
|
catch (err) {
|
|
697
|
-
if (err instanceof
|
|
689
|
+
if (err instanceof AuthKeyUnregistered) {
|
|
698
690
|
await this.propagateAuthorizationState(false);
|
|
699
691
|
}
|
|
700
692
|
throw err;
|
|
@@ -1504,29 +1496,10 @@ export class Client extends ClientAbstract {
|
|
|
1504
1496
|
}));
|
|
1505
1497
|
}
|
|
1506
1498
|
async constructReplyMarkup(params) {
|
|
1507
|
-
let replyMarkup = undefined;
|
|
1508
1499
|
if (params?.replyMarkup) {
|
|
1509
1500
|
await this.assertBot("replyMarkup");
|
|
1510
|
-
|
|
1511
|
-
replyMarkup = await inlineKeyboardMarkupToTlObject(params.replyMarkup, async (v) => {
|
|
1512
|
-
const inputPeer = await this.getInputPeer(v).then((v) => v[as](types.InputPeerUser));
|
|
1513
|
-
return new types.InputUser({ userId: inputPeer.userId, accessHash: inputPeer.accessHash });
|
|
1514
|
-
});
|
|
1515
|
-
}
|
|
1516
|
-
else if ("keyboard" in params.replyMarkup) {
|
|
1517
|
-
replyMarkup = replyKeyboardMarkupToTlObject(params.replyMarkup);
|
|
1518
|
-
}
|
|
1519
|
-
else if ("removeKeyboard" in params.replyMarkup) {
|
|
1520
|
-
replyMarkup = replyKeyboardRemoveToTlObject(params.replyMarkup);
|
|
1521
|
-
}
|
|
1522
|
-
else if ("forceReply" in params.replyMarkup) {
|
|
1523
|
-
replyMarkup = forceReplyToTlObject(params.replyMarkup);
|
|
1524
|
-
}
|
|
1525
|
-
else {
|
|
1526
|
-
throw new Error("The replyMarkup parameter has an unexpected type");
|
|
1527
|
-
}
|
|
1501
|
+
return replyMarkupToTlObject(params.replyMarkup, this.usernameResolver.bind(this));
|
|
1528
1502
|
}
|
|
1529
|
-
return replyMarkup;
|
|
1530
1503
|
}
|
|
1531
1504
|
static assertMsgHas(message, key) {
|
|
1532
1505
|
if (!(key in message) || message[key] === undefined) {
|
|
@@ -1634,6 +1607,32 @@ export class Client extends ClientAbstract {
|
|
|
1634
1607
|
}
|
|
1635
1608
|
await this.invoke(new functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action, topMsgId: messageThreadId }));
|
|
1636
1609
|
}
|
|
1610
|
+
async setMyCommands(commands, params) {
|
|
1611
|
+
await this.invoke(new functions.BotsSetBotCommands({
|
|
1612
|
+
commands: commands.map((v) => new types.BotCommand(v)),
|
|
1613
|
+
langCode: params?.languageCode ?? "",
|
|
1614
|
+
scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)), // TODO: use params.scope
|
|
1615
|
+
}));
|
|
1616
|
+
}
|
|
1617
|
+
async getMyCommands(params) {
|
|
1618
|
+
const commands_ = await this.invoke(new functions.BotsGetBotCommands({
|
|
1619
|
+
langCode: params?.languageCode ?? "",
|
|
1620
|
+
scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)), // TODO: use params.scope
|
|
1621
|
+
}));
|
|
1622
|
+
return commands_.map((v) => ({ command: v.command, description: v.description }));
|
|
1623
|
+
}
|
|
1624
|
+
async answerInlineQuery(id, results, params) {
|
|
1625
|
+
await this.invoke(new functions.MessagesSetInlineBotResults({
|
|
1626
|
+
queryId: BigInt(id),
|
|
1627
|
+
results: await Promise.all(results.map((v) => inlineQueryResultToTlObject(v, this.parseText.bind(this), this.usernameResolver.bind(this)))),
|
|
1628
|
+
cacheTime: params?.cacheTime ?? 300,
|
|
1629
|
+
private: params?.isPersonal ? true : undefined,
|
|
1630
|
+
switchWebview: params?.button && params.button.webApp ? new types.InlineBotWebView({ text: params.button.text, url: params.button.webApp.url }) : undefined,
|
|
1631
|
+
switchPm: params?.button && params.button.startParameter ? new types.InlineBotSwitchPM({ text: params.button.text, startParam: params.button.startParameter }) : undefined,
|
|
1632
|
+
gallery: params?.isGallery ? true : undefined,
|
|
1633
|
+
nextOffset: params?.nextOffset,
|
|
1634
|
+
}));
|
|
1635
|
+
}
|
|
1637
1636
|
use(handler) {
|
|
1638
1637
|
const handle = this.handle;
|
|
1639
1638
|
this.handle = async (upd, next) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import { debug, Mutex } from "../0_deps.js";
|
|
3
|
+
import { UNREACHABLE } from "../1_utilities.js";
|
|
3
4
|
import { ConnectionUnframed } from "./0_connection.js";
|
|
4
5
|
const d = debug("ConnectionWebSocket");
|
|
5
6
|
export class ConnectionWebSocket extends ConnectionUnframed {
|
|
@@ -75,7 +76,7 @@ export class ConnectionWebSocket extends ConnectionUnframed {
|
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
78
|
const release = await mutex.acquire();
|
|
78
|
-
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob
|
|
79
|
+
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : UNREACHABLE())).arrayBuffer());
|
|
79
80
|
for (const byte of data) {
|
|
80
81
|
this.buffer.push(byte);
|
|
81
82
|
}
|
|
@@ -23,11 +23,11 @@ export declare function ige256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uin
|
|
|
23
23
|
* @param iv 16-byte initialization vector
|
|
24
24
|
* @param state 1-byte state
|
|
25
25
|
*/
|
|
26
|
-
export declare function ctr256Encrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array
|
|
26
|
+
export declare function ctr256Encrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array];
|
|
27
27
|
/**
|
|
28
28
|
* Alias of `ctr256Encrypt`
|
|
29
29
|
*/
|
|
30
|
-
export declare function ctr256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array
|
|
30
|
+
export declare function ctr256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array, state: Uint8Array): [Uint8Array, Uint8Array];
|
|
31
31
|
/**
|
|
32
32
|
* Performs CBC-256 encryption.
|
|
33
33
|
*
|