@mtkruto/node 0.1.191 → 0.1.200

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 (173) hide show
  1. package/esm/1_utilities.d.ts +1 -1
  2. package/esm/1_utilities.js +1 -1
  3. package/esm/2_tl.d.ts +6 -6
  4. package/esm/2_tl.js +6 -6
  5. package/esm/3_storage.d.ts +5 -5
  6. package/esm/3_storage.js +5 -5
  7. package/esm/3_types.d.ts +6 -5
  8. package/esm/3_types.js +6 -5
  9. package/esm/4_constants.d.ts +2 -2
  10. package/esm/4_constants.js +2 -2
  11. package/esm/5_client.d.ts +1 -1
  12. package/esm/5_client.js +1 -1
  13. package/esm/client/0_params.d.ts +7 -1
  14. package/esm/client/0_types.d.ts +1 -0
  15. package/esm/client/0_utilities.d.ts +0 -3
  16. package/esm/client/0_utilities.js +0 -20
  17. package/esm/client/1_business_connection_manager.d.ts +11 -0
  18. package/esm/client/1_business_connection_manager.js +47 -0
  19. package/esm/client/1_update_manager.d.ts +8 -1
  20. package/esm/client/1_update_manager.js +88 -8
  21. package/esm/client/2_message_manager.d.ts +7 -6
  22. package/esm/client/2_message_manager.js +48 -31
  23. package/esm/client/4_client.d.ts +421 -420
  24. package/esm/client/4_client.js +565 -516
  25. package/esm/storage/0_storage.d.ts +5 -0
  26. package/esm/storage/0_storage.js +20 -0
  27. package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
  28. package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
  29. package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
  30. package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
  31. package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
  32. package/esm/tl/2_types.d.ts +1071 -183
  33. package/esm/tl/2_types.js +2916 -464
  34. package/esm/tl/3_functions.d.ts +381 -17
  35. package/esm/tl/3_functions.js +1002 -120
  36. package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
  37. package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
  38. package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
  39. package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  40. package/esm/tl/{6_message.js → 7_message.js} +3 -3
  41. package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  42. package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
  43. package/esm/types/0_chat_photo.js +1 -1
  44. package/esm/types/0_message_entity.d.ts +1 -1
  45. package/esm/types/0_thumbnail.js +1 -1
  46. package/esm/types/1_bot_command_scope.d.ts +1 -1
  47. package/esm/types/1_photo.js +2 -2
  48. package/esm/types/1_story_privacy.d.ts +1 -1
  49. package/esm/types/2_business_connection.d.ts +11 -0
  50. package/esm/types/2_business_connection.js +12 -0
  51. package/esm/types/2_chat_member.d.ts +1 -1
  52. package/esm/types/2_chosen_inline_result.d.ts +1 -1
  53. package/esm/types/2_game.js +1 -1
  54. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  55. package/esm/types/2_inline_query.d.ts +1 -1
  56. package/esm/types/2_invite_link.d.ts +1 -1
  57. package/esm/types/2_message_reaction_count.d.ts +1 -1
  58. package/esm/types/2_message_reactions.d.ts +1 -1
  59. package/esm/types/2_story_content.js +1 -1
  60. package/{script/types/1_story_interactive_area.d.ts → esm/types/2_story_interactive_area.d.ts} +2 -2
  61. package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
  62. package/esm/types/3_chat_member_updated.d.ts +1 -1
  63. package/esm/types/3_reply_markup.d.ts +1 -1
  64. package/esm/types/3_story.d.ts +2 -2
  65. package/esm/types/3_story.js +1 -1
  66. package/esm/types/4_inline_query_result.d.ts +1 -1
  67. package/esm/types/4_inline_query_result.js +1 -1
  68. package/esm/types/4_message.d.ts +9 -3
  69. package/esm/types/4_message.js +22 -5
  70. package/esm/types/5_callback_query.d.ts +1 -1
  71. package/esm/types/5_chat.d.ts +1 -1
  72. package/esm/types/6_update.d.ts +12 -2
  73. package/package.json +1 -1
  74. package/script/1_utilities.d.ts +1 -1
  75. package/script/1_utilities.js +1 -1
  76. package/script/2_tl.d.ts +6 -6
  77. package/script/2_tl.js +6 -6
  78. package/script/3_storage.d.ts +5 -5
  79. package/script/3_storage.js +5 -5
  80. package/script/3_types.d.ts +6 -5
  81. package/script/3_types.js +6 -5
  82. package/script/4_constants.d.ts +2 -2
  83. package/script/4_constants.js +2 -2
  84. package/script/5_client.d.ts +1 -1
  85. package/script/5_client.js +1 -1
  86. package/script/client/0_params.d.ts +7 -1
  87. package/script/client/0_types.d.ts +1 -0
  88. package/script/client/0_utilities.d.ts +0 -3
  89. package/script/client/0_utilities.js +1 -23
  90. package/script/client/1_business_connection_manager.d.ts +11 -0
  91. package/script/client/1_business_connection_manager.js +51 -0
  92. package/script/client/1_update_manager.d.ts +8 -1
  93. package/script/client/1_update_manager.js +88 -8
  94. package/script/client/2_message_manager.d.ts +7 -6
  95. package/script/client/2_message_manager.js +47 -30
  96. package/script/client/4_client.d.ts +421 -420
  97. package/script/client/4_client.js +565 -516
  98. package/script/storage/0_storage.d.ts +5 -0
  99. package/script/storage/0_storage.js +20 -0
  100. package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
  101. package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
  102. package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
  103. package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
  104. package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
  105. package/script/tl/2_types.d.ts +1071 -183
  106. package/script/tl/2_types.js +3028 -504
  107. package/script/tl/3_functions.d.ts +381 -17
  108. package/script/tl/3_functions.js +1047 -143
  109. package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
  110. package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
  111. package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
  112. package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  113. package/script/tl/{6_message.js → 7_message.js} +8 -8
  114. package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  115. package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
  116. package/script/types/0_chat_photo.js +9 -9
  117. package/script/types/0_message_entity.d.ts +1 -1
  118. package/script/types/0_thumbnail.js +6 -6
  119. package/script/types/1_bot_command_scope.d.ts +1 -1
  120. package/script/types/1_photo.js +7 -7
  121. package/script/types/1_story_privacy.d.ts +1 -1
  122. package/script/types/2_business_connection.d.ts +11 -0
  123. package/script/types/2_business_connection.js +16 -0
  124. package/script/types/2_chat_member.d.ts +1 -1
  125. package/script/types/2_chosen_inline_result.d.ts +1 -1
  126. package/script/types/2_game.js +3 -3
  127. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  128. package/script/types/2_inline_query.d.ts +1 -1
  129. package/script/types/2_invite_link.d.ts +1 -1
  130. package/script/types/2_message_reaction_count.d.ts +1 -1
  131. package/script/types/2_message_reactions.d.ts +1 -1
  132. package/script/types/2_story_content.js +4 -4
  133. package/{esm/types/1_story_interactive_area.d.ts → script/types/2_story_interactive_area.d.ts} +2 -2
  134. package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
  135. package/script/types/3_chat_member_updated.d.ts +1 -1
  136. package/script/types/3_reply_markup.d.ts +1 -1
  137. package/script/types/3_story.d.ts +2 -2
  138. package/script/types/3_story.js +2 -2
  139. package/script/types/4_inline_query_result.d.ts +1 -1
  140. package/script/types/4_inline_query_result.js +2 -2
  141. package/script/types/4_message.d.ts +9 -3
  142. package/script/types/4_message.js +37 -20
  143. package/script/types/5_callback_query.d.ts +1 -1
  144. package/script/types/5_chat.d.ts +1 -1
  145. package/script/types/6_update.d.ts +12 -2
  146. /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  147. /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
  148. /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  149. /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  150. /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  151. /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  152. /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  153. /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  154. /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  155. /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
  156. /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  157. /package/esm/types/{0__file_id.js → _file_id.js} +0 -0
  158. /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  159. /package/esm/types/{1__getters.js → _getters.js} +0 -0
  160. /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  161. /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
  162. /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  163. /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  164. /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  165. /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  166. /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  167. /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  168. /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  169. /package/script/types/{0_venue.js → 1_venue.js} +0 -0
  170. /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  171. /package/script/types/{0__file_id.js → _file_id.js} +0 -0
  172. /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  173. /package/script/types/{1__getters.js → _getters.js} +0 -0
@@ -1,3 +1,5 @@
1
+ export * from "./types/_file_id.js";
2
+ export * from "./types/_getters.js";
1
3
  export * from "./types/0_authorization_state.js";
2
4
  export * from "./types/0_bot_command.js";
3
5
  export * from "./types/0_chat_action.js";
@@ -7,7 +9,6 @@ export * from "./types/0_chat_photo.js";
7
9
  export * from "./types/0_connection_state.js";
8
10
  export * from "./types/0_contact.js";
9
11
  export * from "./types/0_dice.js";
10
- export * from "./types/0__file_id.js";
11
12
  export * from "./types/0_file_source.js";
12
13
  export * from "./types/0_giveaway_parameters.js";
13
14
  export * from "./types/0_id.js";
@@ -28,14 +29,12 @@ export * from "./types/0_reaction.js";
28
29
  export * from "./types/0_restriction_reason.js";
29
30
  export * from "./types/0_story_reference.js";
30
31
  export * from "./types/0_thumbnail.js";
31
- export * from "./types/0_venue.js";
32
32
  export * from "./types/0_voice.js";
33
33
  export * from "./types/1_animation.js";
34
34
  export * from "./types/1_audio.js";
35
35
  export * from "./types/1_bot_command_scope.js";
36
36
  export * from "./types/1_chat_p.js";
37
37
  export * from "./types/1_document.js";
38
- export * from "./types/1__getters.js";
39
38
  export * from "./types/1_giveaway.js";
40
39
  export * from "./types/1_inline_query_result_button.js";
41
40
  export * from "./types/1_input_message_content.js";
@@ -48,12 +47,13 @@ export * from "./types/1_poll.js";
48
47
  export * from "./types/1_reaction_count.js";
49
48
  export * from "./types/1_reply_quote.js";
50
49
  export * from "./types/1_sticker.js";
51
- export * from "./types/1_story_interactive_area.js";
52
50
  export * from "./types/1_story_privacy.js";
53
51
  export * from "./types/1_story_reaction.js";
54
52
  export * from "./types/1_user.js";
55
- export * from "./types/1_video_note.js";
53
+ export * from "./types/1_venue.js";
56
54
  export * from "./types/1_video.js";
55
+ export * from "./types/1_video_note.js";
56
+ export * from "./types/2_business_connection.js";
57
57
  export * from "./types/2_chat_member.js";
58
58
  export * from "./types/2_chosen_inline_result.js";
59
59
  export * from "./types/2_game.js";
@@ -66,6 +66,7 @@ export * from "./types/2_message_reaction_count.js";
66
66
  export * from "./types/2_message_reactions.js";
67
67
  export * from "./types/2_story_content.js";
68
68
  export * from "./types/2_story_interactions.js";
69
+ export * from "./types/2_story_interactive_area.js";
69
70
  export * from "./types/3_chat_member_updated.js";
70
71
  export * from "./types/3_reply_markup.js";
71
72
  export * from "./types/3_story.js";
package/script/3_types.js CHANGED
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/_file_id.js"), exports);
18
+ __exportStar(require("./types/_getters.js"), exports);
17
19
  __exportStar(require("./types/0_authorization_state.js"), exports);
18
20
  __exportStar(require("./types/0_bot_command.js"), exports);
19
21
  __exportStar(require("./types/0_chat_action.js"), exports);
@@ -23,7 +25,6 @@ __exportStar(require("./types/0_chat_photo.js"), exports);
23
25
  __exportStar(require("./types/0_connection_state.js"), exports);
24
26
  __exportStar(require("./types/0_contact.js"), exports);
25
27
  __exportStar(require("./types/0_dice.js"), exports);
26
- __exportStar(require("./types/0__file_id.js"), exports);
27
28
  __exportStar(require("./types/0_file_source.js"), exports);
28
29
  __exportStar(require("./types/0_giveaway_parameters.js"), exports);
29
30
  __exportStar(require("./types/0_id.js"), exports);
@@ -44,14 +45,12 @@ __exportStar(require("./types/0_reaction.js"), exports);
44
45
  __exportStar(require("./types/0_restriction_reason.js"), exports);
45
46
  __exportStar(require("./types/0_story_reference.js"), exports);
46
47
  __exportStar(require("./types/0_thumbnail.js"), exports);
47
- __exportStar(require("./types/0_venue.js"), exports);
48
48
  __exportStar(require("./types/0_voice.js"), exports);
49
49
  __exportStar(require("./types/1_animation.js"), exports);
50
50
  __exportStar(require("./types/1_audio.js"), exports);
51
51
  __exportStar(require("./types/1_bot_command_scope.js"), exports);
52
52
  __exportStar(require("./types/1_chat_p.js"), exports);
53
53
  __exportStar(require("./types/1_document.js"), exports);
54
- __exportStar(require("./types/1__getters.js"), exports);
55
54
  __exportStar(require("./types/1_giveaway.js"), exports);
56
55
  __exportStar(require("./types/1_inline_query_result_button.js"), exports);
57
56
  __exportStar(require("./types/1_input_message_content.js"), exports);
@@ -64,12 +63,13 @@ __exportStar(require("./types/1_poll.js"), exports);
64
63
  __exportStar(require("./types/1_reaction_count.js"), exports);
65
64
  __exportStar(require("./types/1_reply_quote.js"), exports);
66
65
  __exportStar(require("./types/1_sticker.js"), exports);
67
- __exportStar(require("./types/1_story_interactive_area.js"), exports);
68
66
  __exportStar(require("./types/1_story_privacy.js"), exports);
69
67
  __exportStar(require("./types/1_story_reaction.js"), exports);
70
68
  __exportStar(require("./types/1_user.js"), exports);
71
- __exportStar(require("./types/1_video_note.js"), exports);
69
+ __exportStar(require("./types/1_venue.js"), exports);
72
70
  __exportStar(require("./types/1_video.js"), exports);
71
+ __exportStar(require("./types/1_video_note.js"), exports);
72
+ __exportStar(require("./types/2_business_connection.js"), exports);
73
73
  __exportStar(require("./types/2_chat_member.js"), exports);
74
74
  __exportStar(require("./types/2_chosen_inline_result.js"), exports);
75
75
  __exportStar(require("./types/2_game.js"), exports);
@@ -82,6 +82,7 @@ __exportStar(require("./types/2_message_reaction_count.js"), exports);
82
82
  __exportStar(require("./types/2_message_reactions.js"), exports);
83
83
  __exportStar(require("./types/2_story_content.js"), exports);
84
84
  __exportStar(require("./types/2_story_interactions.js"), exports);
85
+ __exportStar(require("./types/2_story_interactive_area.js"), exports);
85
86
  __exportStar(require("./types/3_chat_member_updated.js"), exports);
86
87
  __exportStar(require("./types/3_reply_markup.js"), exports);
87
88
  __exportStar(require("./types/3_story.js"), exports);
@@ -2,8 +2,8 @@ import { DC } from "./3_transport.js";
2
2
  export type PublicKeys = readonly [bigint, [bigint, bigint]][];
3
3
  export declare const PUBLIC_KEYS: PublicKeys;
4
4
  export declare const INITIAL_DC: DC;
5
- export declare const LAYER = 176;
6
- export declare const APP_VERSION = "MTKruto 0.1.190";
5
+ export declare const LAYER = 177;
6
+ export declare const APP_VERSION = "MTKruto";
7
7
  export declare const DEVICE_MODEL: string;
8
8
  export declare const LANG_CODE: string;
9
9
  export declare const LANG_PACK = "";
@@ -77,8 +77,8 @@ exports.PUBLIC_KEYS = Object.freeze([
77
77
  ],
78
78
  ]);
79
79
  exports.INITIAL_DC = "2";
80
- exports.LAYER = 176;
81
- exports.APP_VERSION = "MTKruto 0.1.190";
80
+ exports.LAYER = 177;
81
+ exports.APP_VERSION = "MTKruto";
82
82
  // @ts-ignore: lib
83
83
  exports.DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : (navigator.userAgent.split(" ")[0] || "Unknown") : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
84
84
  exports.LANG_CODE = typeof navigator === "undefined" || typeof navigator.language !== "string" ? "en" : navigator.language.split("-")[0];
@@ -1,4 +1,4 @@
1
1
  export * from "./client/0_params.js";
2
- export * from "./client/1_client_plain.js";
3
2
  export * from "./client/1_client_encrypted.js";
3
+ export * from "./client/1_client_plain.js";
4
4
  export * from "./client/4_client.js";
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client/0_params.js"), exports);
18
- __exportStar(require("./client/1_client_plain.js"), exports);
19
18
  __exportStar(require("./client/1_client_encrypted.js"), exports);
19
+ __exportStar(require("./client/1_client_plain.js"), exports);
20
20
  __exportStar(require("./client/4_client.js"), exports);
@@ -15,7 +15,10 @@ export interface AuthorizeUserParams<S = string> {
15
15
  code: S | (() => MaybePromise<S>);
16
16
  password: S | ((hint: string | null) => MaybePromise<S>);
17
17
  }
18
- export interface _SendCommon {
18
+ export interface _BusinessConnectionIdCommon {
19
+ businessConnectionId?: string;
20
+ }
21
+ export interface _SendCommon extends _BusinessConnectionIdCommon {
19
22
  /** Whether to send the message in a silent way without making a sound on the recipients' clients. */
20
23
  disableNotification?: boolean;
21
24
  /** Whether to protect the contents of the message from copying and forwarding. */
@@ -39,6 +42,9 @@ export interface SendMessageParams extends _SendCommon {
39
42
  /** The message's link preview. */
40
43
  linkPreview?: LinkPreview;
41
44
  }
45
+ export interface SendChatActionParams extends _BusinessConnectionIdCommon {
46
+ messageThreadId?: number;
47
+ }
42
48
  export interface EditMessageParams {
43
49
  /** The parse mode to use. If not provided, the default parse mode will be used. */
44
50
  parseMode?: ParseMode;
@@ -40,5 +40,6 @@ export interface C {
40
40
  ignoreOutgoing: boolean | null;
41
41
  cdn: boolean;
42
42
  dropPendingUpdates?: boolean;
43
+ invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, businessConnectionId: string | undefined): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
43
44
  }
44
45
  export {};
@@ -1,8 +1,5 @@
1
- import { enums, types } from "../2_tl.js";
2
1
  import { FileSource } from "../3_types.js";
3
2
  export declare const resolve: () => Promise<void>;
4
- 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;
5
- export declare function isChannelPtsUpdate(v: enums.Update | enums.Updates): v is types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages | types.UpdateChannelTooLong;
6
3
  export declare function getFileContents(source: FileSource, fileName?: string): Promise<readonly [Uint8Array, string]>;
7
4
  export declare function isHttpUrl(string: string): boolean;
8
5
  export declare function getUsername(string: string): string;
@@ -23,35 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getChatListId = exports.getUsername = exports.isHttpUrl = exports.getFileContents = exports.isChannelPtsUpdate = exports.isPtsUpdate = exports.resolve = void 0;
26
+ exports.getChatListId = exports.getUsername = exports.isHttpUrl = exports.getFileContents = exports.resolve = void 0;
27
27
  const dntShim = __importStar(require("../_dnt.shims.js"));
28
28
  const _0_deps_js_1 = require("../0_deps.js");
29
29
  const _0_errors_js_1 = require("../0_errors.js");
30
30
  const _1_utilities_js_1 = require("../1_utilities.js");
31
- const _2_tl_js_1 = require("../2_tl.js");
32
31
  const resolve = () => Promise.resolve();
33
32
  exports.resolve = resolve;
34
- function isPtsUpdate(v) {
35
- return v instanceof _2_tl_js_1.types.UpdateNewMessage ||
36
- v instanceof _2_tl_js_1.types.UpdateDeleteMessages ||
37
- v instanceof _2_tl_js_1.types.UpdateReadHistoryInbox ||
38
- v instanceof _2_tl_js_1.types.UpdateReadHistoryOutbox ||
39
- v instanceof _2_tl_js_1.types.UpdatePinnedChannelMessages ||
40
- v instanceof _2_tl_js_1.types.UpdatePinnedMessages ||
41
- v instanceof _2_tl_js_1.types.UpdateFolderPeers ||
42
- v instanceof _2_tl_js_1.types.UpdateChannelWebPage ||
43
- v instanceof _2_tl_js_1.types.UpdateEditMessage ||
44
- v instanceof _2_tl_js_1.types.UpdateReadMessagesContents ||
45
- v instanceof _2_tl_js_1.types.UpdateWebPage;
46
- }
47
- exports.isPtsUpdate = isPtsUpdate;
48
- function isChannelPtsUpdate(v) {
49
- return v instanceof _2_tl_js_1.types.UpdateNewChannelMessage ||
50
- v instanceof _2_tl_js_1.types.UpdateEditChannelMessage ||
51
- v instanceof _2_tl_js_1.types.UpdateDeleteChannelMessages ||
52
- v instanceof _2_tl_js_1.types.UpdateChannelTooLong;
53
- }
54
- exports.isChannelPtsUpdate = isChannelPtsUpdate;
55
33
  async function getFileContents(source, fileName = "") {
56
34
  fileName = fileName.trim() || "file";
57
35
  let contents;
@@ -0,0 +1,11 @@
1
+ import { enums, types } from "../2_tl.js";
2
+ import { Update } from "../3_types.js";
3
+ import { C } from "./0_types.js";
4
+ export type BusinessConnectionManagerUpdate = types.UpdateBotBusinessConnect;
5
+ export declare class BusinessConnectionManager {
6
+ #private;
7
+ constructor(c: C);
8
+ getBusinessConnection(id: string): Promise<import("../3_types.js").BusinessConnection>;
9
+ static canHandleUpdate(update: enums.Update): update is BusinessConnectionManagerUpdate;
10
+ handleUpdate(update: BusinessConnectionManagerUpdate): Promise<Update>;
11
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _BusinessConnectionManager_c;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.BusinessConnectionManager = void 0;
16
+ const _2_tl_js_1 = require("../2_tl.js");
17
+ const _3_types_js_1 = require("../3_types.js");
18
+ class BusinessConnectionManager {
19
+ constructor(c) {
20
+ _BusinessConnectionManager_c.set(this, void 0);
21
+ __classPrivateFieldSet(this, _BusinessConnectionManager_c, c, "f");
22
+ }
23
+ async getBusinessConnection(id) {
24
+ const connection_ = await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.getBusinessConnection(id);
25
+ if (!connection_) {
26
+ const connection_ = await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").api.account.getBotBusinessConnection({ connection_id: id })
27
+ .then((v) => v[_2_tl_js_1.as](_2_tl_js_1.types.Updates))
28
+ .then((v) => v.updates[0][_2_tl_js_1.as](_2_tl_js_1.types.UpdateBotBusinessConnect).connection);
29
+ await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(id, connection_);
30
+ return await (0, _3_types_js_1.constructBusinessConnection)(connection_, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
31
+ }
32
+ else {
33
+ return await (0, _3_types_js_1.constructBusinessConnection)(connection_, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
34
+ }
35
+ }
36
+ static canHandleUpdate(update) {
37
+ return update instanceof _2_tl_js_1.types.UpdateBotBusinessConnect;
38
+ }
39
+ async handleUpdate(update) {
40
+ if (update.connection.disabled) {
41
+ await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(update.connection.connection_id, null);
42
+ }
43
+ else {
44
+ await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(update.connection.connection_id, update.connection);
45
+ }
46
+ const businessConnection = await (0, _3_types_js_1.constructBusinessConnection)(update.connection, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
47
+ return { businessConnection };
48
+ }
49
+ }
50
+ exports.BusinessConnectionManager = BusinessConnectionManager;
51
+ _BusinessConnectionManager_c = new WeakMap();
@@ -1,11 +1,18 @@
1
1
  import { Queue } from "../1_utilities.js";
2
- import { enums, ReadObject, TLObject } from "../2_tl.js";
2
+ import { enums, ReadObject, TLObject, types } from "../2_tl.js";
3
3
  import { C } from "./0_types.js";
4
4
  type UpdateHandler = (update: enums.Update) => Promise<(() => Promise<unknown>)>;
5
+ export type PtsUpdate = types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
6
+ export type ChannelPtsUpdate = types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages | types.UpdateChannelTooLong;
7
+ export type QtsUpdate = types.UpdateNewEncryptedMessage | types.UpdateMessagePollVote | types.UpdateBotStopped | types.UpdateChatParticipant | types.UpdateChannelParticipant | types.UpdateBotChatInviteRequester | types.UpdateBotChatBoost | types.UpdateBotMessageReaction | types.UpdateBotMessageReactions | types.UpdateBotBusinessConnect | types.UpdateBotNewBusinessMessage | types.UpdateBotEditBusinessMessage | types.UpdateBotDeleteBusinessMessage;
5
8
  export declare class UpdateManager {
6
9
  #private;
10
+ static readonly QTS_COUNT = 1;
7
11
  static readonly MAIN_BOX_ID = 0n;
8
12
  constructor(c: C);
13
+ static isPtsUpdate(v: enums.Update): v is PtsUpdate;
14
+ static isQtsUpdate(v: enums.Update): v is QtsUpdate;
15
+ static isChannelPtsUpdate(v: enums.Update | enums.Updates): v is ChannelPtsUpdate;
9
16
  fetchState(source: string): Promise<void>;
10
17
  processChats(chats: enums.Chat[]): Promise<void>;
11
18
  processResult(result: ReadObject): Promise<void>;
@@ -10,13 +10,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_getLocalState, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
13
+ var _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkGapQts, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processQtsUpdateInner, _UpdateManager_qtsUpdateQueue, _UpdateManager_processQtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_setUpdateQts, _UpdateManager_getLocalState, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.UpdateManager = void 0;
16
16
  const _1_utilities_js_1 = require("../1_utilities.js");
17
17
  const _2_tl_js_1 = require("../2_tl.js");
18
18
  const _4_constants_js_1 = require("../4_constants.js");
19
- const _0_utilities_js_1 = require("./0_utilities.js");
20
19
  class UpdateManager {
21
20
  constructor(c) {
22
21
  _UpdateManager_instances.add(this);
@@ -34,6 +33,7 @@ class UpdateManager {
34
33
  _UpdateManager_nonFirst.set(this, new Set());
35
34
  _UpdateManager_channelUpdateQueues.set(this, new Map());
36
35
  _UpdateManager_ptsUpdateQueue.set(this, new _1_utilities_js_1.Queue("ptsUpdate"));
36
+ _UpdateManager_qtsUpdateQueue.set(this, new _1_utilities_js_1.Queue("qtsUpdate"));
37
37
  _UpdateManager_processUpdatesQueue.set(this, new _1_utilities_js_1.Queue("UpdateManager/processUpdates"));
38
38
  _UpdateManager_handleUpdatesSet.set(this, new Set());
39
39
  __classPrivateFieldSet(this, _UpdateManager_c, c, "f");
@@ -44,8 +44,49 @@ class UpdateManager {
44
44
  __classPrivateFieldSet(this, _UpdateManager_L$processUpdates, L.branch("#processUpdates"), "f");
45
45
  __classPrivateFieldSet(this, _UpdateManager_LfetchState, L.branch("fetchState"), "f");
46
46
  }
47
+ static isPtsUpdate(v) {
48
+ return v instanceof _2_tl_js_1.types.UpdateNewMessage ||
49
+ v instanceof _2_tl_js_1.types.UpdateDeleteMessages ||
50
+ v instanceof _2_tl_js_1.types.UpdateReadHistoryInbox ||
51
+ v instanceof _2_tl_js_1.types.UpdateReadHistoryOutbox ||
52
+ v instanceof _2_tl_js_1.types.UpdatePinnedChannelMessages ||
53
+ v instanceof _2_tl_js_1.types.UpdatePinnedMessages ||
54
+ v instanceof _2_tl_js_1.types.UpdateFolderPeers ||
55
+ v instanceof _2_tl_js_1.types.UpdateChannelWebPage ||
56
+ v instanceof _2_tl_js_1.types.UpdateEditMessage ||
57
+ v instanceof _2_tl_js_1.types.UpdateReadMessagesContents ||
58
+ v instanceof _2_tl_js_1.types.UpdateWebPage;
59
+ }
60
+ static isQtsUpdate(v) {
61
+ return v instanceof _2_tl_js_1.types.UpdateNewEncryptedMessage ||
62
+ v instanceof _2_tl_js_1.types.UpdateMessagePollVote ||
63
+ v instanceof _2_tl_js_1.types.UpdateBotStopped ||
64
+ v instanceof _2_tl_js_1.types.UpdateChatParticipant ||
65
+ v instanceof _2_tl_js_1.types.UpdateChannelParticipant ||
66
+ v instanceof _2_tl_js_1.types.UpdateBotChatInviteRequester ||
67
+ v instanceof _2_tl_js_1.types.UpdateBotChatBoost ||
68
+ v instanceof _2_tl_js_1.types.UpdateBotMessageReaction ||
69
+ v instanceof _2_tl_js_1.types.UpdateBotMessageReactions ||
70
+ v instanceof _2_tl_js_1.types.UpdateBotBusinessConnect ||
71
+ v instanceof _2_tl_js_1.types.UpdateBotNewBusinessMessage ||
72
+ v instanceof _2_tl_js_1.types.UpdateBotEditBusinessMessage ||
73
+ v instanceof _2_tl_js_1.types.UpdateBotDeleteBusinessMessage;
74
+ }
75
+ static isChannelPtsUpdate(v) {
76
+ return v instanceof _2_tl_js_1.types.UpdateNewChannelMessage ||
77
+ v instanceof _2_tl_js_1.types.UpdateEditChannelMessage ||
78
+ v instanceof _2_tl_js_1.types.UpdateDeleteChannelMessages ||
79
+ v instanceof _2_tl_js_1.types.UpdateChannelTooLong;
80
+ }
47
81
  async fetchState(source) {
48
- const state = await __classPrivateFieldGet(this, _UpdateManager_c, "f").api.updates.getState();
82
+ let state = await __classPrivateFieldGet(this, _UpdateManager_c, "f").api.updates.getState();
83
+ const difference = await __classPrivateFieldGet(this, _UpdateManager_c, "f").api.updates.getDifference(state);
84
+ if (difference instanceof _2_tl_js_1.types.updates.Difference) {
85
+ state = difference.state;
86
+ }
87
+ else if (difference instanceof _2_tl_js_1.types.updates.DifferenceSlice) {
88
+ state = difference.intermediate_state;
89
+ }
49
90
  __classPrivateFieldSet(this, _UpdateManager_updateState, state, "f");
50
91
  __classPrivateFieldGet(this, _UpdateManager_LfetchState, "f").debug(`state fetched [${source}]`);
51
92
  if (await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_mustDropPendingUpdates).call(this)) {
@@ -241,7 +282,7 @@ class UpdateManager {
241
282
  }
242
283
  }
243
284
  exports.UpdateManager = UpdateManager;
244
- _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState = new WeakMap(), _UpdateManager_updateHandler = new WeakMap(), _UpdateManager_LrecoverUpdateGap = new WeakMap(), _UpdateManager_LrecoverChannelUpdateGap = new WeakMap(), _UpdateManager_L$handleUpdate = new WeakMap(), _UpdateManager_L$processUpdates = new WeakMap(), _UpdateManager_LfetchState = new WeakMap(), _UpdateManager_defaultDropPendingUpdates = new WeakMap(), _UpdateManager_state = new WeakMap(), _UpdateManager_handleUpdateQueues = new WeakMap(), _UpdateManager_nonFirst = new WeakMap(), _UpdateManager_channelUpdateQueues = new WeakMap(), _UpdateManager_ptsUpdateQueue = new WeakMap(), _UpdateManager_processUpdatesQueue = new WeakMap(), _UpdateManager_handleUpdatesSet = new WeakMap(), _UpdateManager_instances = new WeakSet(), _UpdateManager_mustDropPendingUpdates = async function _UpdateManager_mustDropPendingUpdates() {
285
+ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState = new WeakMap(), _UpdateManager_updateHandler = new WeakMap(), _UpdateManager_LrecoverUpdateGap = new WeakMap(), _UpdateManager_LrecoverChannelUpdateGap = new WeakMap(), _UpdateManager_L$handleUpdate = new WeakMap(), _UpdateManager_L$processUpdates = new WeakMap(), _UpdateManager_LfetchState = new WeakMap(), _UpdateManager_defaultDropPendingUpdates = new WeakMap(), _UpdateManager_state = new WeakMap(), _UpdateManager_handleUpdateQueues = new WeakMap(), _UpdateManager_nonFirst = new WeakMap(), _UpdateManager_channelUpdateQueues = new WeakMap(), _UpdateManager_ptsUpdateQueue = new WeakMap(), _UpdateManager_qtsUpdateQueue = new WeakMap(), _UpdateManager_processUpdatesQueue = new WeakMap(), _UpdateManager_handleUpdatesSet = new WeakMap(), _UpdateManager_instances = new WeakSet(), _UpdateManager_mustDropPendingUpdates = async function _UpdateManager_mustDropPendingUpdates() {
245
286
  if (typeof __classPrivateFieldGet(this, _UpdateManager_c, "f").dropPendingUpdates === "boolean") {
246
287
  return __classPrivateFieldGet(this, _UpdateManager_c, "f").dropPendingUpdates;
247
288
  }
@@ -278,7 +319,12 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
278
319
  }, _UpdateManager_checkGap = async function _UpdateManager_checkGap(pts, ptsCount) {
279
320
  const localState = await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_getLocalState).call(this);
280
321
  if (localState.pts + ptsCount < pts) {
281
- await this.recoverUpdateGap("processUpdates");
322
+ await this.recoverUpdateGap("processUpdates[pts]");
323
+ }
324
+ }, _UpdateManager_checkGapQts = async function _UpdateManager_checkGapQts(qts) {
325
+ const localState = await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_getLocalState).call(this);
326
+ if (localState.qts + _a.QTS_COUNT < qts) {
327
+ await this.recoverUpdateGap("processUpdates[qts]");
282
328
  }
283
329
  }, _UpdateManager_checkChannelGap = async function _UpdateManager_checkChannelGap(channelId, pts, ptsCount) {
284
330
  let localPts = await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck).call(this, channelId);
@@ -350,11 +396,32 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
350
396
  if (update.pts != 0) {
351
397
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setUpdatePts).call(this, update.pts);
352
398
  }
353
- __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_queueUpdate).call(this, update, 0n, true);
399
+ __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_queueUpdate).call(this, update, 1n, false);
354
400
  }, _UpdateManager_processPtsUpdate = function _UpdateManager_processPtsUpdate(update, checkGap) {
355
401
  __classPrivateFieldGet(this, _UpdateManager_ptsUpdateQueue, "f").add(async () => {
356
402
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processPtsUpdateInner).call(this, update, checkGap);
357
403
  });
404
+ }, _UpdateManager_processQtsUpdateInner = async function _UpdateManager_processQtsUpdateInner(update, checkGap) {
405
+ const localState = await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_getLocalState).call(this);
406
+ if (update.qts != 0) {
407
+ if (checkGap) {
408
+ await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_checkGapQts).call(this, update.qts);
409
+ }
410
+ if (localState.qts + _a.QTS_COUNT > update.qts) {
411
+ return;
412
+ }
413
+ }
414
+ if (__classPrivateFieldGet(this, _UpdateManager_c, "f").guaranteeUpdateDelivery) {
415
+ await __classPrivateFieldGet(this, _UpdateManager_c, "f").storage.setUpdate(_a.MAIN_BOX_ID, update);
416
+ }
417
+ if (update.qts != 0) {
418
+ await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setUpdateQts).call(this, update.qts);
419
+ }
420
+ __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_queueUpdate).call(this, update, 0n, true);
421
+ }, _UpdateManager_processQtsUpdate = function _UpdateManager_processQtsUpdate(update, checkGap) {
422
+ __classPrivateFieldGet(this, _UpdateManager_qtsUpdateQueue, "f").add(async () => {
423
+ await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processQtsUpdateInner).call(this, update, checkGap);
424
+ });
358
425
  }, _UpdateManager_processUpdates = async function _UpdateManager_processUpdates(updates_, checkGap, call = null) {
359
426
  /// First, individual updates (Update[1]) are extracted from Updates.[2]
360
427
  ///
@@ -502,12 +569,15 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
502
569
  (0, _1_utilities_js_1.UNREACHABLE)();
503
570
  }
504
571
  }
505
- else if ((0, _0_utilities_js_1.isPtsUpdate)(update)) {
572
+ else if (_a.isPtsUpdate(update)) {
506
573
  __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processPtsUpdate).call(this, update, checkGap);
507
574
  }
508
- else if ((0, _0_utilities_js_1.isChannelPtsUpdate)(update)) {
575
+ else if (_a.isChannelPtsUpdate(update)) {
509
576
  __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processChannelPtsUpdate).call(this, update, checkGap);
510
577
  }
578
+ else if (_a.isQtsUpdate(update)) {
579
+ __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processQtsUpdate).call(this, update, checkGap);
580
+ }
511
581
  else {
512
582
  __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_queueUpdate).call(this, update, 0n, false);
513
583
  }
@@ -520,6 +590,10 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
520
590
  const localState = await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_getLocalState).call(this);
521
591
  localState.pts = pts;
522
592
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, localState);
593
+ }, _UpdateManager_setUpdateQts = async function _UpdateManager_setUpdateQts(qts) {
594
+ const localState = await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_getLocalState).call(this);
595
+ localState.qts = qts;
596
+ await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, localState);
523
597
  }, _UpdateManager_getLocalState = async function _UpdateManager_getLocalState() {
524
598
  let localState = await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_getState).call(this);
525
599
  if (!localState) {
@@ -627,6 +701,12 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
627
701
  return () => Promise.resolve();
628
702
  }
629
703
  };
704
+ Object.defineProperty(UpdateManager, "QTS_COUNT", {
705
+ enumerable: true,
706
+ configurable: true,
707
+ writable: true,
708
+ value: 1
709
+ });
630
710
  Object.defineProperty(UpdateManager, "MAIN_BOX_ID", {
631
711
  enumerable: true,
632
712
  configurable: true,
@@ -1,12 +1,12 @@
1
1
  import { enums, types } from "../2_tl.js";
2
2
  import { ChatAction, ChatMember, FileSource, FileType, ID, Message, MessageEntity, ParseMode, Reaction, Update, UsernameResolver } from "../3_types.js";
3
- import { AddReactionParams, BanChatMemberParams, CreateInviteLinkParams, DeleteMessagesParams, EditMessageLiveLocationParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetCreatedInviteLinksParams, GetHistoryParams, PinMessageParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetReactionsParams, StopPollParams } from "./0_params.js";
3
+ import { AddReactionParams, BanChatMemberParams, CreateInviteLinkParams, DeleteMessagesParams, EditMessageLiveLocationParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetCreatedInviteLinksParams, GetHistoryParams, PinMessageParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChatActionParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetReactionsParams, StopPollParams } from "./0_params.js";
4
4
  import { C as C_ } from "./0_types.js";
5
5
  import { FileManager } from "./1_file_manager.js";
6
6
  interface C extends C_ {
7
7
  fileManager: FileManager;
8
8
  }
9
- type MessageManagerUpdate = types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages | types.UpdateChannelParticipant | types.UpdateChatParticipant;
9
+ type MessageManagerUpdate = types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateBotNewBusinessMessage | types.UpdateBotEditBusinessMessage | types.UpdateBotDeleteBusinessMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages | types.UpdateChannelParticipant | types.UpdateChatParticipant;
10
10
  export declare class MessageManager {
11
11
  #private;
12
12
  constructor(c: C);
@@ -18,7 +18,10 @@ export declare class MessageManager {
18
18
  parseMode?: ParseMode;
19
19
  entities?: MessageEntity[];
20
20
  }): Promise<readonly [string, enums.MessageEntity[] | undefined]>;
21
- constructMessage(message_: enums.Message, r?: boolean): Promise<Message>;
21
+ constructMessage(message_: enums.Message, r?: boolean, business?: {
22
+ connectionId: string;
23
+ replyToMessage?: enums.Message;
24
+ }): Promise<Message>;
22
25
  forwardMessages(from: ID, to: ID, messageIds: number[], params?: ForwardMessagesParams): Promise<Message[]>;
23
26
  getHistory(chatId: ID, params?: GetHistoryParams): Promise<Message[]>;
24
27
  usernameResolver: UsernameResolver;
@@ -56,9 +59,7 @@ export declare class MessageManager {
56
59
  removeReaction(chatId: number, messageId: number, reaction: Reaction): Promise<void>;
57
60
  static canHandleUpdate(update: enums.Update): update is MessageManagerUpdate;
58
61
  handleUpdate(update: MessageManagerUpdate): Promise<Update | null>;
59
- sendChatAction(chatId: ID, action: ChatAction, params?: {
60
- messageThreadId?: number;
61
- }): Promise<void>;
62
+ sendChatAction(chatId: ID, action: ChatAction, params?: SendChatActionParams): Promise<void>;
62
63
  deleteChatPhoto(chatId: number): Promise<void>;
63
64
  setChatPhoto(chatId: number, photo: FileSource, params?: SetChatPhotoParams): Promise<void>;
64
65
  banChatMember(chatId: ID, memberId: ID, params?: BanChatMemberParams): Promise<void>;