@mtkruto/node 0.1.133 → 0.1.135

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 (162) hide show
  1. package/esm/3_errors.d.ts +519 -510
  2. package/esm/3_errors.js +521 -509
  3. package/esm/3_types.d.ts +16 -7
  4. package/esm/3_types.js +16 -7
  5. package/esm/4_constants.d.ts +1 -1
  6. package/esm/4_constants.js +1 -1
  7. package/esm/4_errors.d.ts +7 -12
  8. package/esm/4_errors.js +6 -7
  9. package/esm/5_client.d.ts +3 -3
  10. package/esm/5_client.js +3 -3
  11. package/esm/client/0_utilities.d.ts +28 -0
  12. package/esm/client/0_utilities.js +10 -0
  13. package/esm/client/1_composer.d.ts +30 -0
  14. package/esm/client/{4_composer.js → 1_composer.js} +3 -2
  15. package/esm/client/2_client_plain.d.ts +1 -1
  16. package/esm/client/2_client_plain.js +1 -1
  17. package/{script/client/3_types.d.ts → esm/client/3_params.d.ts} +68 -177
  18. package/esm/client/3_params.js +1 -0
  19. package/esm/client/{5_client.d.ts → 4_client.d.ts} +57 -25
  20. package/esm/client/{5_client.js → 4_client.js} +347 -160
  21. package/esm/client/5_composer.d.ts +4 -0
  22. package/esm/client/5_composer.js +3 -0
  23. package/esm/storage/0_storage.d.ts +4 -1
  24. package/esm/storage/0_storage.js +36 -7
  25. package/esm/storage/1_storage_indexed_db.d.ts +6 -2
  26. package/esm/storage/1_storage_indexed_db.js +7 -5
  27. package/esm/storage/1_storage_local_storage.d.ts +1 -1
  28. package/esm/storage/1_storage_local_storage.js +1 -1
  29. package/esm/storage/1_storage_memory.d.ts +1 -1
  30. package/esm/storage/1_storage_memory.js +1 -1
  31. package/esm/storage/1_storage_session_storage.d.ts +1 -1
  32. package/esm/storage/1_storage_session_storage.js +1 -1
  33. package/esm/tl/3_utilities.d.ts +1 -0
  34. package/esm/tl/3_utilities.js +14 -0
  35. package/esm/tl/6_message.js +1 -1
  36. package/esm/types/0_authorization_state.d.ts +5 -0
  37. package/esm/types/0_authorization_state.js +1 -0
  38. package/esm/types/0_connection_state.d.ts +17 -0
  39. package/esm/types/0_connection_state.js +1 -0
  40. package/esm/types/0_login_url.d.ts +0 -4
  41. package/esm/types/0_mask_position.d.ts +0 -4
  42. package/esm/types/0_message_entity.d.ts +0 -2
  43. package/esm/types/0_message_identifier.d.ts +4 -0
  44. package/esm/types/0_message_identifier.js +1 -0
  45. package/esm/types/0_network_statistics_entry.d.ts +4 -0
  46. package/esm/types/0_network_statistics_entry.js +1 -0
  47. package/esm/types/0_reaction.d.ts +1 -0
  48. package/esm/types/0_reaction.js +13 -0
  49. package/esm/types/1__getters.d.ts +3 -0
  50. package/esm/types/1_chat_p.d.ts +1 -0
  51. package/esm/types/1_keyboard_button.d.ts +1 -23
  52. package/esm/types/1_network_statistics.d.ts +5 -0
  53. package/esm/types/1_network_statistics.js +1 -0
  54. package/esm/types/1_poll.d.ts +0 -13
  55. package/esm/types/1_reaction_count.d.ts +7 -0
  56. package/esm/types/1_reaction_count.js +6 -0
  57. package/esm/types/2_game.d.ts +0 -7
  58. package/esm/types/2_inline_keyboard_button.d.ts +0 -8
  59. package/esm/types/2_inline_query.d.ts +0 -6
  60. package/esm/types/2_message_interactions.d.ts +8 -0
  61. package/esm/types/2_message_interactions.js +1 -0
  62. package/esm/types/2_message_reaction_count.d.ts +8 -0
  63. package/esm/types/2_message_reaction_count.js +1 -0
  64. package/esm/types/2_reply_keyboard_markup.d.ts +0 -7
  65. package/esm/types/3_inline_keyboard_markup.d.ts +0 -2
  66. package/{script/types/3_message.d.ts → esm/types/4_message.d.ts} +225 -7
  67. package/esm/types/{3_message.js → 4_message.js} +14 -24
  68. package/{script/types/4_callback_query.d.ts → esm/types/5_callback_query.d.ts} +1 -1
  69. package/esm/types/{4_chat.d.ts → 5_chat.d.ts} +3 -3
  70. package/esm/types/{4_chat.js → 5_chat.js} +2 -2
  71. package/esm/types/6_update.d.ts +134 -0
  72. package/esm/types/6_update.js +1 -0
  73. package/package.json +1 -1
  74. package/script/3_errors.d.ts +519 -510
  75. package/script/3_errors.js +533 -520
  76. package/script/3_types.d.ts +16 -7
  77. package/script/3_types.js +16 -7
  78. package/script/4_constants.d.ts +1 -1
  79. package/script/4_constants.js +1 -1
  80. package/script/4_errors.d.ts +7 -12
  81. package/script/4_errors.js +5 -6
  82. package/script/5_client.d.ts +3 -3
  83. package/script/5_client.js +3 -3
  84. package/script/client/0_utilities.d.ts +28 -0
  85. package/script/client/0_utilities.js +12 -1
  86. package/script/client/1_composer.d.ts +30 -0
  87. package/script/client/{4_composer.js → 1_composer.js} +5 -4
  88. package/script/client/2_client_plain.d.ts +1 -1
  89. package/script/client/2_client_plain.js +2 -2
  90. package/{esm/client/3_types.d.ts → script/client/3_params.d.ts} +68 -177
  91. package/script/client/3_params.js +2 -0
  92. package/script/client/{5_client.d.ts → 4_client.d.ts} +57 -25
  93. package/script/client/{5_client.js → 4_client.js} +353 -166
  94. package/script/client/5_composer.d.ts +4 -0
  95. package/script/client/{6_composer.js → 5_composer.js} +2 -2
  96. package/script/storage/0_storage.d.ts +4 -1
  97. package/script/storage/0_storage.js +36 -7
  98. package/script/storage/1_storage_indexed_db.d.ts +6 -2
  99. package/script/storage/1_storage_indexed_db.js +7 -5
  100. package/script/storage/1_storage_local_storage.d.ts +1 -1
  101. package/script/storage/1_storage_local_storage.js +1 -1
  102. package/script/storage/1_storage_memory.d.ts +1 -1
  103. package/script/storage/1_storage_memory.js +1 -1
  104. package/script/storage/1_storage_session_storage.d.ts +1 -1
  105. package/script/storage/1_storage_session_storage.js +1 -1
  106. package/script/tl/3_utilities.d.ts +1 -0
  107. package/script/tl/3_utilities.js +16 -1
  108. package/script/tl/6_message.js +1 -1
  109. package/script/types/0_authorization_state.d.ts +5 -0
  110. package/script/types/0_authorization_state.js +2 -0
  111. package/script/types/0_connection_state.d.ts +17 -0
  112. package/script/types/0_connection_state.js +2 -0
  113. package/script/types/0_login_url.d.ts +0 -4
  114. package/script/types/0_mask_position.d.ts +0 -4
  115. package/script/types/0_message_entity.d.ts +0 -2
  116. package/script/types/0_message_identifier.d.ts +4 -0
  117. package/script/types/0_message_identifier.js +2 -0
  118. package/script/types/0_network_statistics_entry.d.ts +4 -0
  119. package/script/types/0_network_statistics_entry.js +2 -0
  120. package/script/types/0_reaction.d.ts +1 -0
  121. package/script/types/0_reaction.js +15 -1
  122. package/script/types/1__getters.d.ts +3 -0
  123. package/script/types/1_chat_p.d.ts +1 -0
  124. package/script/types/1_keyboard_button.d.ts +1 -23
  125. package/script/types/1_network_statistics.d.ts +5 -0
  126. package/script/types/1_network_statistics.js +2 -0
  127. package/script/types/1_poll.d.ts +0 -13
  128. package/script/types/1_reaction_count.d.ts +7 -0
  129. package/script/types/1_reaction_count.js +10 -0
  130. package/script/types/2_game.d.ts +0 -7
  131. package/script/types/2_inline_keyboard_button.d.ts +0 -8
  132. package/script/types/2_inline_query.d.ts +0 -6
  133. package/script/types/2_message_interactions.d.ts +8 -0
  134. package/script/types/2_message_interactions.js +2 -0
  135. package/script/types/2_message_reaction_count.d.ts +8 -0
  136. package/script/types/2_message_reaction_count.js +2 -0
  137. package/script/types/2_reply_keyboard_markup.d.ts +0 -7
  138. package/script/types/3_inline_keyboard_markup.d.ts +0 -2
  139. package/{esm/types/3_message.d.ts → script/types/4_message.d.ts} +225 -7
  140. package/script/types/{3_message.js → 4_message.js} +15 -25
  141. package/{esm/types/4_callback_query.d.ts → script/types/5_callback_query.d.ts} +1 -1
  142. package/script/types/{4_chat.d.ts → 5_chat.d.ts} +3 -3
  143. package/script/types/{4_chat.js → 5_chat.js} +3 -3
  144. package/script/types/6_update.d.ts +134 -0
  145. package/script/types/6_update.js +2 -0
  146. package/esm/client/3_types.js +0 -11
  147. package/esm/client/4_composer.d.ts +0 -31
  148. package/esm/client/6_composer.d.ts +0 -4
  149. package/esm/client/6_composer.js +0 -3
  150. package/script/client/3_types.js +0 -15
  151. package/script/client/4_composer.d.ts +0 -31
  152. package/script/client/6_composer.d.ts +0 -4
  153. /package/esm/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
  154. /package/esm/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
  155. /package/esm/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
  156. /package/esm/types/{0_audio.js → 1_audio.js} +0 -0
  157. /package/esm/types/{4_callback_query.js → 5_callback_query.js} +0 -0
  158. /package/script/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
  159. /package/script/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
  160. /package/script/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
  161. /package/script/types/{0_audio.js → 1_audio.js} +0 -0
  162. /package/script/types/{4_callback_query.js → 5_callback_query.js} +0 -0
package/esm/3_types.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- export * from "./types/0_audio.js";
1
+ export * from "./types/0__file_id.js";
2
+ export * from "./types/0_authorization_state.js";
2
3
  export * from "./types/0_bot_command.js";
3
4
  export * from "./types/0_chat_action.js";
4
5
  export * from "./types/0_chat_administrator_rights.js";
5
6
  export * from "./types/0_chat_id.js";
6
7
  export * from "./types/0_chat_photo.js";
8
+ export * from "./types/0_connection_state.js";
7
9
  export * from "./types/0_contact.js";
8
10
  export * from "./types/0_dice.js";
9
- export * from "./types/0__file_id.js";
10
11
  export * from "./types/0_force_reply.js";
11
12
  export * from "./types/0_giveaway_parameters.js";
12
13
  export * from "./types/0_input_contact_message_content.js";
@@ -18,6 +19,8 @@ export * from "./types/0_location.js";
18
19
  export * from "./types/0_login_url.js";
19
20
  export * from "./types/0_mask_position.js";
20
21
  export * from "./types/0_message_entity.js";
22
+ export * from "./types/0_message_identifier.js";
23
+ export * from "./types/0_network_statistics_entry.js";
21
24
  export * from "./types/0_parse_mode.js";
22
25
  export * from "./types/0_poll_option.js";
23
26
  export * from "./types/0_reaction.js";
@@ -27,34 +30,36 @@ export * from "./types/0_thumbnail.js";
27
30
  export * from "./types/0_venue.js";
28
31
  export * from "./types/0_voice.js";
29
32
  export * from "./types/0_web_app_info.js";
33
+ export * from "./types/1__getters.js";
30
34
  export * from "./types/1_animation.js";
35
+ export * from "./types/1_audio.js";
31
36
  export * from "./types/1_bot_command_scope.js";
32
37
  export * from "./types/1_chat_p.js";
33
38
  export * from "./types/1_document.js";
34
39
  export * from "./types/1_giveaway.js";
35
- export * from "./types/1__getters.js";
36
40
  export * from "./types/1_inline_query_result_button.js";
37
41
  export * from "./types/1_input_invoice_message_content.js";
38
42
  export * from "./types/1_input_text_message_content.js";
39
43
  export * from "./types/1_keyboard_button.js";
40
44
  export * from "./types/1_message_reaction.js";
45
+ export * from "./types/1_network_statistics.js";
41
46
  export * from "./types/1_photo.js";
42
47
  export * from "./types/1_poll.js";
48
+ export * from "./types/1_reaction_count.js";
43
49
  export * from "./types/1_reply_quote.js";
44
50
  export * from "./types/1_sticker.js";
45
51
  export * from "./types/1_user.js";
46
- export * from "./types/1_video_note.js";
47
52
  export * from "./types/1_video.js";
53
+ export * from "./types/1_video_note.js";
48
54
  export * from "./types/2_chosen_inline_result.js";
49
55
  export * from "./types/2_game.js";
50
56
  export * from "./types/2_inline_keyboard_button.js";
51
57
  export * from "./types/2_inline_query.js";
52
58
  export * from "./types/2_input_message_content.js";
59
+ export * from "./types/2_message_interactions.js";
60
+ export * from "./types/2_message_reaction_count.js";
53
61
  export * from "./types/2_reply_keyboard_markup.js";
54
62
  export * from "./types/3_inline_keyboard_markup.js";
55
- export * from "./types/3_message.js";
56
- export * from "./types/4_callback_query.js";
57
- export * from "./types/4_chat.js";
58
63
  export * from "./types/4_inline_query_result_article.js";
59
64
  export * from "./types/4_inline_query_result_audio.js";
60
65
  export * from "./types/4_inline_query_result_cached_audio.js";
@@ -75,5 +80,9 @@ export * from "./types/4_inline_query_result_photo.js";
75
80
  export * from "./types/4_inline_query_result_venue.js";
76
81
  export * from "./types/4_inline_query_result_video.js";
77
82
  export * from "./types/4_inline_query_result_voice.js";
83
+ export * from "./types/4_message.js";
78
84
  export * from "./types/4_reply_markup.js";
85
+ export * from "./types/5_callback_query.js";
86
+ export * from "./types/5_chat.js";
79
87
  export * from "./types/5_inline_query_result.js";
88
+ export * from "./types/6_update.js";
package/esm/3_types.js CHANGED
@@ -1,12 +1,13 @@
1
- export * from "./types/0_audio.js";
1
+ export * from "./types/0__file_id.js";
2
+ export * from "./types/0_authorization_state.js";
2
3
  export * from "./types/0_bot_command.js";
3
4
  export * from "./types/0_chat_action.js";
4
5
  export * from "./types/0_chat_administrator_rights.js";
5
6
  export * from "./types/0_chat_id.js";
6
7
  export * from "./types/0_chat_photo.js";
8
+ export * from "./types/0_connection_state.js";
7
9
  export * from "./types/0_contact.js";
8
10
  export * from "./types/0_dice.js";
9
- export * from "./types/0__file_id.js";
10
11
  export * from "./types/0_force_reply.js";
11
12
  export * from "./types/0_giveaway_parameters.js";
12
13
  export * from "./types/0_input_contact_message_content.js";
@@ -18,6 +19,8 @@ export * from "./types/0_location.js";
18
19
  export * from "./types/0_login_url.js";
19
20
  export * from "./types/0_mask_position.js";
20
21
  export * from "./types/0_message_entity.js";
22
+ export * from "./types/0_message_identifier.js";
23
+ export * from "./types/0_network_statistics_entry.js";
21
24
  export * from "./types/0_parse_mode.js";
22
25
  export * from "./types/0_poll_option.js";
23
26
  export * from "./types/0_reaction.js";
@@ -27,34 +30,36 @@ export * from "./types/0_thumbnail.js";
27
30
  export * from "./types/0_venue.js";
28
31
  export * from "./types/0_voice.js";
29
32
  export * from "./types/0_web_app_info.js";
33
+ export * from "./types/1__getters.js";
30
34
  export * from "./types/1_animation.js";
35
+ export * from "./types/1_audio.js";
31
36
  export * from "./types/1_bot_command_scope.js";
32
37
  export * from "./types/1_chat_p.js";
33
38
  export * from "./types/1_document.js";
34
39
  export * from "./types/1_giveaway.js";
35
- export * from "./types/1__getters.js";
36
40
  export * from "./types/1_inline_query_result_button.js";
37
41
  export * from "./types/1_input_invoice_message_content.js";
38
42
  export * from "./types/1_input_text_message_content.js";
39
43
  export * from "./types/1_keyboard_button.js";
40
44
  export * from "./types/1_message_reaction.js";
45
+ export * from "./types/1_network_statistics.js";
41
46
  export * from "./types/1_photo.js";
42
47
  export * from "./types/1_poll.js";
48
+ export * from "./types/1_reaction_count.js";
43
49
  export * from "./types/1_reply_quote.js";
44
50
  export * from "./types/1_sticker.js";
45
51
  export * from "./types/1_user.js";
46
- export * from "./types/1_video_note.js";
47
52
  export * from "./types/1_video.js";
53
+ export * from "./types/1_video_note.js";
48
54
  export * from "./types/2_chosen_inline_result.js";
49
55
  export * from "./types/2_game.js";
50
56
  export * from "./types/2_inline_keyboard_button.js";
51
57
  export * from "./types/2_inline_query.js";
52
58
  export * from "./types/2_input_message_content.js";
59
+ export * from "./types/2_message_interactions.js";
60
+ export * from "./types/2_message_reaction_count.js";
53
61
  export * from "./types/2_reply_keyboard_markup.js";
54
62
  export * from "./types/3_inline_keyboard_markup.js";
55
- export * from "./types/3_message.js";
56
- export * from "./types/4_callback_query.js";
57
- export * from "./types/4_chat.js";
58
63
  export * from "./types/4_inline_query_result_article.js";
59
64
  export * from "./types/4_inline_query_result_audio.js";
60
65
  export * from "./types/4_inline_query_result_cached_audio.js";
@@ -75,5 +80,9 @@ export * from "./types/4_inline_query_result_photo.js";
75
80
  export * from "./types/4_inline_query_result_venue.js";
76
81
  export * from "./types/4_inline_query_result_video.js";
77
82
  export * from "./types/4_inline_query_result_voice.js";
83
+ export * from "./types/4_message.js";
78
84
  export * from "./types/4_reply_markup.js";
85
+ export * from "./types/5_callback_query.js";
86
+ export * from "./types/5_chat.js";
79
87
  export * from "./types/5_inline_query_result.js";
88
+ export * from "./types/6_update.js";
@@ -4,7 +4,7 @@ export type PublicKeys = readonly [bigint, [bigint, bigint]][];
4
4
  export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const INITIAL_DC: DC;
6
6
  export declare const LAYER = 169;
7
- export declare const APP_VERSION = "MTKruto 0.1.133";
7
+ export declare const APP_VERSION = "MTKruto 0.1.135";
8
8
  export declare const DEVICE_MODEL: string;
9
9
  export declare const LANG_CODE: string;
10
10
  export declare const LANG_PACK = "";
@@ -53,7 +53,7 @@ export const PUBLIC_KEYS = Object.freeze([
53
53
  ]);
54
54
  export const INITIAL_DC = "2";
55
55
  export const LAYER = 169;
56
- export const APP_VERSION = "MTKruto 0.1.133";
56
+ export const APP_VERSION = "MTKruto 0.1.135";
57
57
  // @ts-ignore: lib
58
58
  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;
59
59
  export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
package/esm/4_errors.d.ts CHANGED
@@ -1,18 +1,13 @@
1
- import { types } from "./2_tl.js";
1
+ import { ErrorWithCall, ErrorWithCallParams } from "./3_errors.js";
2
+ import { TLObject, types } from "./2_tl.js";
2
3
  export * from "./3_errors.js";
3
- export declare class FloodWait extends types.Rpc_error {
4
+ export declare class FloodWait extends ErrorWithCall {
4
5
  seconds: number;
5
- constructor(params: {
6
- error_code: number;
7
- error_message: string;
8
- });
6
+ constructor(params: ErrorWithCallParams);
9
7
  }
10
- export declare class Migrate extends types.Rpc_error {
8
+ export declare class Migrate extends ErrorWithCall {
11
9
  dc: number;
12
- constructor(params: {
13
- error_code: number;
14
- error_message: string;
15
- });
10
+ constructor(params: ErrorWithCallParams);
16
11
  }
17
12
  export declare class UserMigrate extends Migrate {
18
13
  }
@@ -22,4 +17,4 @@ export declare class FileMigrate extends Migrate {
22
17
  }
23
18
  export declare class StatsMigrate extends Migrate {
24
19
  }
25
- export declare function upgradeInstance(error: types.Rpc_error): import("./tl/2_types.js").Rpc_error_;
20
+ export declare function upgradeInstance(error: types.Rpc_error, call: TLObject): import("./tl/2_types.js").Rpc_error_;
package/esm/4_errors.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { UNREACHABLE } from "./1_utilities.js";
2
- import { map } from "./3_errors.js";
3
- import { types } from "./2_tl.js";
2
+ import { ErrorWithCall, map } from "./3_errors.js";
4
3
  export * from "./3_errors.js";
5
- export class FloodWait extends types.Rpc_error {
4
+ export class FloodWait extends ErrorWithCall {
6
5
  constructor(params) {
7
6
  super(params);
8
7
  Object.defineProperty(this, "seconds", {
@@ -18,7 +17,7 @@ export class FloodWait extends types.Rpc_error {
18
17
  }
19
18
  }
20
19
  }
21
- export class Migrate extends types.Rpc_error {
20
+ export class Migrate extends ErrorWithCall {
22
21
  constructor(params) {
23
22
  super(params);
24
23
  Object.defineProperty(this, "dc", {
@@ -49,15 +48,15 @@ const prefixMap = {
49
48
  "STATS_MIGRATE_": StatsMigrate,
50
49
  "FLOOD_WAIT_": FloodWait,
51
50
  };
52
- export function upgradeInstance(error) {
51
+ export function upgradeInstance(error, call) {
53
52
  for (const [k, v] of Object.entries(prefixMap)) {
54
53
  if (error.error_message.startsWith(k)) {
55
- return new v(error);
54
+ return new v({ ...error, call });
56
55
  }
57
56
  }
58
57
  for (const [k, v] of Object.entries(map)) {
59
58
  if (error.error_message == k) {
60
- return new v(error);
59
+ return new v({ ...error, call });
61
60
  }
62
61
  }
63
62
  return error;
package/esm/5_client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from "./client/2_client_plain.js";
2
- export * from "./client/3_types.js";
3
- export * from "./client/5_client.js";
4
- export * from "./client/6_composer.js";
2
+ export * from "./client/3_params.js";
3
+ export * from "./client/4_client.js";
4
+ export * from "./client/5_composer.js";
package/esm/5_client.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from "./client/2_client_plain.js";
2
- export * from "./client/3_types.js";
3
- export * from "./client/5_client.js";
4
- export * from "./client/6_composer.js";
2
+ export * from "./client/3_params.js";
3
+ export * from "./client/4_client.js";
4
+ export * from "./client/5_composer.js";
@@ -1,4 +1,5 @@
1
1
  import { enums, types } from "../2_tl.js";
2
+ import { ChatP, Message, MessageTypes, UpdateMap, User } from "../3_types.js";
2
3
  export declare const resolve: () => Promise<void>;
3
4
  export type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
4
5
  export declare function isPtsUpdate(v: enums.Update): v is types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
@@ -10,3 +11,30 @@ export type FileSource = string | URL | Uint8Array;
10
11
  export declare function getFileContents(source: FileSource, fileName?: string): Promise<readonly [Uint8Array, string]>;
11
12
  export declare function isHttpUrl(string: string): boolean;
12
13
  export declare function getUsername(string: string): string;
14
+ export declare function getChatListId(chatList: string): 0 | 1;
15
+ type MessageWith<T extends keyof MessageTypes, F extends number | string | symbol> = F extends keyof MessageTypes[T] ? MessageTypes[T] & {
16
+ [P in F]-?: NonNullable<MessageTypes[T][P]>;
17
+ } : MessageTypes[T];
18
+ type Me<U extends keyof UpdateMap> = U extends "connectionState" | "authorizationState" ? {
19
+ me?: User;
20
+ } : {
21
+ me: User;
22
+ };
23
+ type Msg<U extends keyof UpdateMap, T extends keyof MessageTypes, F extends number | string | symbol = ""> = U extends "message" | "editedMessage" ? {
24
+ msg: MessageFilter<U, T, F>;
25
+ chat: ChatP;
26
+ } : {
27
+ msg?: Message;
28
+ };
29
+ type From<U extends keyof UpdateMap> = U extends "callbackQuery" | "inlineQuery" ? {
30
+ from: User;
31
+ } : {
32
+ from?: User;
33
+ };
34
+ type MessageFilter<U extends keyof UpdateMap, T extends keyof MessageTypes, F extends number | string | symbol> = U extends "message" ? {
35
+ message: MessageWith<T, F>;
36
+ } : U extends "editedMessage" ? {
37
+ editedMessage: MessageWith<T, F>;
38
+ } : UpdateMap[U];
39
+ export type WithUpdate<C, U extends keyof UpdateMap, T extends keyof MessageTypes, F extends number | string | symbol = ""> = C & Me<U> & Msg<U, T, F> & From<U> & MessageFilter<U, T, F>;
40
+ export {};
@@ -135,3 +135,13 @@ export function getUsername(string) {
135
135
  }
136
136
  return validateUsername(parts[0]);
137
137
  }
138
+ export function getChatListId(chatList) {
139
+ switch (chatList) {
140
+ case "main":
141
+ return 0;
142
+ case "archived":
143
+ return 1;
144
+ default:
145
+ UNREACHABLE();
146
+ }
147
+ }
@@ -0,0 +1,30 @@
1
+ import { MessageTypes, Update, UpdateIntersection, UpdateMap, User } from "../3_types.js";
2
+ import { WithUpdate } from "./0_utilities.js";
3
+ type MaybePromise<T> = T | Promise<T>;
4
+ export type NextFunction = () => Promise<void>;
5
+ export type MiddlewareFn<C> = (ctx: C, next: NextFunction) => MaybePromise<unknown>;
6
+ export interface MiddlewareObj<C> {
7
+ middleware: () => MiddlewareFn<C>;
8
+ }
9
+ export type Middleware<C> = MiddlewareFn<C> | MiddlewareObj<C>;
10
+ export declare function flatten<C>(mw: Middleware<C>): MiddlewareFn<C>;
11
+ export declare function concat<C = Update>(left: MiddlewareFn<C>, right: MiddlewareFn<C>): MiddlewareFn<C>;
12
+ export declare function skip<C>(_ctx: C, next: NextFunction): Promise<void>;
13
+ export declare class Composer<C extends {
14
+ me?: User;
15
+ }> implements MiddlewareObj<C> {
16
+ #private;
17
+ set prefixes(value: string | string[]);
18
+ constructor(...middleware: Middleware<C>[]);
19
+ middleware(): MiddlewareFn<C>;
20
+ use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<UpdateIntersection<C>>;
21
+ branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<UpdateIntersection<C>>;
22
+ filter<D extends C>(predicate: (ctx: UpdateIntersection<C>) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
23
+ filter(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, ...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
24
+ on<T extends keyof UpdateMap, F extends string, K extends keyof MessageTypes>(filter: T extends "message" | "editedMessage" ? T | [T, K, ...F[]] : T, ...middleawre: Middleware<WithUpdate<C, T, K, F>>[]): Composer<WithUpdate<C, T, K, F>>;
25
+ command(commands: string | RegExp | (string | RegExp)[] | {
26
+ names: string | RegExp | (string | RegExp)[];
27
+ prefixes: string | string[];
28
+ }, ...middleawre: Middleware<WithUpdate<C, "message", "text">>[]): Composer<WithUpdate<C, "message", "text", string>>;
29
+ }
30
+ export {};
@@ -28,7 +28,9 @@ export function concat(left, right) {
28
28
  });
29
29
  };
30
30
  }
31
- export const skip = (_ctx, next) => next();
31
+ export function skip(_ctx, next) {
32
+ return next();
33
+ }
32
34
  export class Composer {
33
35
  set prefixes(value) {
34
36
  if (__classPrivateFieldGet(this, _Composer_prefixes, "f") !== undefined) {
@@ -95,7 +97,6 @@ export class Composer {
95
97
  else {
96
98
  return false;
97
99
  }
98
- // deno-lint-ignore no-explicit-any
99
100
  }, ...middleawre);
100
101
  }
101
102
  command(commands, ...middleawre) {
@@ -1,6 +1,6 @@
1
1
  import { functions } from "../2_tl.js";
2
2
  import { PublicKeys } from "../4_constants.js";
3
- import { ClientAbstract, ClientAbstractParams } from "./1_client_abstract.js";
3
+ import { ClientAbstract, ClientAbstractParams } from "./0_client_abstract.js";
4
4
  export interface ClientPlainParams extends ClientAbstractParams {
5
5
  /**
6
6
  * MTProto public keys to use in the `[keyId, [key, exponent]][]` format. Don't set this unless you know what you are doing. Defaults to Telegram servers' public keys.
@@ -14,8 +14,8 @@ import { assertEquals, assertInstanceOf, debug, factorize, ige256Decrypt, ige256
14
14
  import { bigIntFromBuffer, bufferFromBigInt, concat, getRandomBigInt, modExp, rsaPad, sha1, UNREACHABLE } from "../1_utilities.js";
15
15
  import { functions, serialize, TLReader, types } from "../2_tl.js";
16
16
  import { PUBLIC_KEYS } from "../4_constants.js";
17
+ import { ClientAbstract } from "./0_client_abstract.js";
17
18
  import { getMessageId, packUnencryptedMessage, unpackUnencryptedMessage } from "./0_message.js";
18
- import { ClientAbstract } from "./1_client_abstract.js";
19
19
  const d = debug("ClientPlain/createAuthKey");
20
20
  export class ClientPlain extends ClientAbstract {
21
21
  constructor(params) {