@mtkruto/node 0.0.996 → 0.0.998

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 (181) hide show
  1. package/esm/0_deps.d.ts +2 -2
  2. package/esm/0_deps.js +2 -2
  3. package/esm/3_types.d.ts +1 -0
  4. package/esm/3_types.js +1 -0
  5. package/esm/4_constants.d.ts +1 -1
  6. package/esm/4_constants.js +1 -1
  7. package/esm/client/0_html.js +1 -1
  8. package/esm/client/3_types.d.ts +3 -2
  9. package/esm/client/3_types.js +1 -1
  10. package/esm/client/4_client.d.ts +11 -4
  11. package/esm/client/4_client.js +60 -9
  12. package/esm/deps/deno.land/std@0.201.0/assert/assert_greater.d.ts +5 -0
  13. package/esm/deps/deno.land/std@0.201.0/assert/assert_greater.js +14 -0
  14. package/esm/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.d.ts +5 -0
  15. package/esm/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.js +14 -0
  16. package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.js +2 -2
  17. package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.js +4 -1
  18. package/esm/deps/deno.land/std@0.201.0/assert/assert_less.d.ts +5 -0
  19. package/esm/deps/deno.land/std@0.201.0/assert/assert_less.js +14 -0
  20. package/esm/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.d.ts +5 -0
  21. package/esm/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.js +14 -0
  22. package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.d.ts +4 -0
  23. package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.js +4 -0
  24. package/{script/deps/deno.land/std@0.200.0 → esm/deps/deno.land/std@0.201.0}/fmt/colors.d.ts +8 -1
  25. package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/fmt/colors.js +8 -1
  26. package/esm/tl/3_tl_reader.d.ts +1 -1
  27. package/esm/tl/3_tl_reader.js +6 -0
  28. package/esm/tl/4_tl_writer.js +8 -0
  29. package/esm/tl/6_message.js +3 -0
  30. package/esm/types/0_chat_action.d.ts +1 -0
  31. package/esm/types/0_chat_action.js +1 -0
  32. package/esm/types/0_message_entity.d.ts +10 -10
  33. package/esm/types/0_message_entity.js +12 -12
  34. package/esm/types/1_chat.d.ts +5 -10
  35. package/esm/types/1_chat.js +4 -11
  36. package/esm/types/1_sticker.d.ts +2 -2
  37. package/esm/types/1_sticker.js +1 -1
  38. package/esm/types/3_message.js +3 -3
  39. package/package.json +1 -1
  40. package/script/0_deps.d.ts +2 -2
  41. package/script/0_deps.js +2 -2
  42. package/script/3_types.d.ts +1 -0
  43. package/script/3_types.js +1 -0
  44. package/script/4_constants.d.ts +1 -1
  45. package/script/4_constants.js +1 -1
  46. package/script/client/0_html.js +1 -1
  47. package/script/client/3_types.d.ts +3 -2
  48. package/script/client/3_types.js +3 -0
  49. package/script/client/4_client.d.ts +11 -4
  50. package/script/client/4_client.js +60 -9
  51. package/script/deps/deno.land/std@0.201.0/assert/assert_greater.d.ts +5 -0
  52. package/script/deps/deno.land/std@0.201.0/assert/assert_greater.js +18 -0
  53. package/script/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.d.ts +5 -0
  54. package/script/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.js +18 -0
  55. package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.js +2 -2
  56. package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.js +4 -1
  57. package/script/deps/deno.land/std@0.201.0/assert/assert_less.d.ts +5 -0
  58. package/script/deps/deno.land/std@0.201.0/assert/assert_less.js +18 -0
  59. package/script/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.d.ts +5 -0
  60. package/script/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.js +18 -0
  61. package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.d.ts +4 -0
  62. package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.js +4 -0
  63. package/{esm/deps/deno.land/std@0.200.0 → script/deps/deno.land/std@0.201.0}/fmt/colors.d.ts +8 -1
  64. package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/fmt/colors.js +10 -3
  65. package/script/tl/3_tl_reader.d.ts +1 -1
  66. package/script/tl/3_tl_reader.js +6 -0
  67. package/script/tl/4_tl_writer.js +8 -0
  68. package/script/tl/6_message.js +3 -0
  69. package/script/types/0_chat_action.d.ts +1 -0
  70. package/script/types/0_chat_action.js +2 -0
  71. package/script/types/0_message_entity.d.ts +10 -10
  72. package/script/types/0_message_entity.js +12 -12
  73. package/script/types/1_chat.d.ts +5 -10
  74. package/script/types/1_chat.js +5 -12
  75. package/script/types/1_sticker.d.ts +2 -2
  76. package/script/types/1_sticker.js +1 -1
  77. package/script/types/3_message.js +2 -2
  78. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.d.ts +0 -0
  79. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.js +0 -0
  80. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.d.ts +0 -0
  81. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.js +0 -0
  82. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.d.ts +0 -0
  83. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.js +0 -0
  84. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.d.ts +0 -0
  85. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.js +0 -0
  86. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.d.ts +0 -0
  87. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.js +0 -0
  88. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.d.ts +0 -0
  89. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.js +0 -0
  90. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.d.ts +0 -0
  91. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.js +0 -0
  92. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.d.ts +0 -0
  93. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.js +0 -0
  94. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.d.ts +0 -0
  95. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.js +0 -0
  96. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.d.ts +0 -0
  97. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.d.ts +0 -0
  98. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.d.ts +0 -0
  99. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.js +0 -0
  100. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.d.ts +0 -0
  101. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.js +0 -0
  102. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.d.ts +0 -0
  103. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.js +0 -0
  104. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.d.ts +0 -0
  105. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.js +0 -0
  106. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.d.ts +0 -0
  107. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.js +0 -0
  108. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.d.ts +0 -0
  109. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.js +0 -0
  110. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.d.ts +0 -0
  111. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.js +0 -0
  112. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.d.ts +0 -0
  113. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.js +0 -0
  114. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.d.ts +0 -0
  115. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.js +0 -0
  116. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.d.ts +0 -0
  117. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.js +0 -0
  118. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.d.ts +0 -0
  119. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.js +0 -0
  120. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.d.ts +0 -0
  121. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.js +0 -0
  122. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.d.ts +0 -0
  123. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.js +0 -0
  124. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.d.ts +0 -0
  125. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.js +0 -0
  126. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.d.ts +0 -0
  127. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.js +0 -0
  128. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/encoding/base64.d.ts +0 -0
  129. /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/encoding/base64.js +0 -0
  130. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.d.ts +0 -0
  131. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.js +0 -0
  132. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.d.ts +0 -0
  133. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.js +0 -0
  134. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.d.ts +0 -0
  135. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.js +0 -0
  136. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.d.ts +0 -0
  137. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.js +0 -0
  138. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.d.ts +0 -0
  139. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.js +0 -0
  140. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.d.ts +0 -0
  141. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.js +0 -0
  142. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.d.ts +0 -0
  143. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.js +0 -0
  144. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.d.ts +0 -0
  145. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.js +0 -0
  146. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.d.ts +0 -0
  147. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.js +0 -0
  148. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.d.ts +0 -0
  149. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.d.ts +0 -0
  150. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.d.ts +0 -0
  151. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.js +0 -0
  152. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.d.ts +0 -0
  153. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.js +0 -0
  154. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.d.ts +0 -0
  155. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.js +0 -0
  156. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.d.ts +0 -0
  157. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.js +0 -0
  158. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.d.ts +0 -0
  159. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.js +0 -0
  160. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.d.ts +0 -0
  161. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.js +0 -0
  162. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.d.ts +0 -0
  163. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.js +0 -0
  164. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.d.ts +0 -0
  165. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.js +0 -0
  166. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.d.ts +0 -0
  167. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.js +0 -0
  168. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.d.ts +0 -0
  169. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.js +0 -0
  170. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.d.ts +0 -0
  171. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.js +0 -0
  172. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.d.ts +0 -0
  173. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.js +0 -0
  174. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.d.ts +0 -0
  175. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.js +0 -0
  176. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.d.ts +0 -0
  177. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.js +0 -0
  178. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.d.ts +0 -0
  179. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.js +0 -0
  180. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/encoding/base64.d.ts +0 -0
  181. /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/encoding/base64.js +0 -0
package/esm/0_deps.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from "./deps/deno.land/std@0.200.0/assert/mod.js";
1
+ export * from "./deps/deno.land/std@0.201.0/assert/mod.js";
2
2
  export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.1.3/mod.js";
3
3
  export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/gzip/gzip.js";
4
4
  export { Mutex, type MutexInterface } from "async-mutex";
5
5
  export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
6
6
  import { debug as debug_ } from "./deps/raw.githubusercontent.com/MTKruto/debug/main/mod.js";
7
7
  export declare const debug: typeof debug_;
8
- export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.200.0/encoding/base64.js";
8
+ export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.201.0/encoding/base64.js";
package/esm/0_deps.js CHANGED
@@ -1,8 +1,8 @@
1
- export * from "./deps/deno.land/std@0.200.0/assert/mod.js";
1
+ export * from "./deps/deno.land/std@0.201.0/assert/mod.js";
2
2
  export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.1.3/mod.js";
3
3
  export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/gzip/gzip.js";
4
4
  export { Mutex } from "async-mutex";
5
5
  export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
6
6
  import { debug as debug_ } from "./deps/raw.githubusercontent.com/MTKruto/debug/main/mod.js";
7
7
  export const debug = (v) => debug_(v);
8
- export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.200.0/encoding/base64.js";
8
+ export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.201.0/encoding/base64.js";
package/esm/3_types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./types/!0_file_id.js";
2
2
  export * from "./types/0_audio.js";
3
+ export * from "./types/0_chat_action.js";
3
4
  export * from "./types/0_chat_administrator_rights.js";
4
5
  export * from "./types/0_chat_photo.js";
5
6
  export * from "./types/0_contact.js";
package/esm/3_types.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./types/!0_file_id.js";
2
2
  export * from "./types/0_audio.js";
3
+ export * from "./types/0_chat_action.js";
3
4
  export * from "./types/0_chat_administrator_rights.js";
4
5
  export * from "./types/0_chat_photo.js";
5
6
  export * from "./types/0_contact.js";
@@ -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.996";
8
+ export declare const APP_VERSION = "MTKruto 0.0.998";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -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.996";
57
+ export const APP_VERSION = "MTKruto 0.0.998";
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];
@@ -27,7 +27,7 @@ export function parseHtml(html) {
27
27
  if (!url) {
28
28
  throw new Error("Missing attribute href");
29
29
  }
30
- queue.push({ type: "text_link", offset: text.length, length: 0, url });
30
+ queue.push({ type: "textLink", offset: text.length, length: 0, url });
31
31
  break;
32
32
  }
33
33
  case "ins":
@@ -2,7 +2,7 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { CallbackQuery, 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
- export type ParseMode = "html" | "none";
5
+ export type ParseMode = "HTML" | null;
6
6
  export interface ClientParams extends ClientPlainParams {
7
7
  /**
8
8
  * A parse mode to use when the `parseMode` parameter is not specified when sending or editing messages. Defauls to `ParseMode.None`.
@@ -196,7 +196,7 @@ export interface SendPollParams {
196
196
  */
197
197
  protectContent?: boolean;
198
198
  }
199
- export type ConnectionState = "not-connected" | "updating" | "ready";
199
+ export type ConnectionState = "notConnected" | "updating" | "ready";
200
200
  export type AuthorizationState = {
201
201
  authorized: boolean;
202
202
  };
@@ -217,3 +217,4 @@ export interface Handler<U extends Partial<Update> = Partial<Update>> {
217
217
  export type FilterUpdate<U extends Update, T extends keyof U, F extends keyof NonNullable<U[T]>> = With<U, T> & Pick<{
218
218
  [P in T]-?: With<NonNullable<U[T]>, F>;
219
219
  }, T>;
220
+ export declare const skip: Handler;
@@ -1 +1 @@
1
- export {};
1
+ export const skip = (__, _) => _();
@@ -2,7 +2,7 @@ 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 { Message } from "../3_types.js";
5
+ import { ChatAction, Message } from "../3_types.js";
6
6
  import { With } from "./0_utilities.js";
7
7
  import { ClientAbstract } from "./1_client_abstract.js";
8
8
  import { AnswerCallbackQueryParams, AuthorizeUserParams, ChatID, ClientParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, Handler, ParseMode, SendMessagesParams, SendPollParams, Update } from "./3_types.js";
@@ -36,7 +36,6 @@ export declare class Client extends ClientAbstract {
36
36
  * @param storage The storage provider to use. Defaults to memory storage.
37
37
  * @param apiId App's API ID from [my.telegram.org](https://my.telegram.org/apps). Defaults to 0 (unset).
38
38
  * @param apiHash App's API hash from [my.telegram.org/apps](https://my.telegram.org/apps). Defaults to empty string (unset).
39
- * @param params Other parameters.
40
39
  */
41
40
  constructor(storage?: Storage, apiId?: number | null, apiHash?: string | null, params?: ClientParams);
42
41
  private propagateConnectionState;
@@ -203,10 +202,18 @@ export declare class Client extends ClientAbstract {
203
202
  * @param options The poll's options.
204
203
  */
205
204
  sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<With<Message, "poll">>;
205
+ /**
206
+ * Send a chat action.
207
+ *
208
+ * @param chatId The chat to send the chat action to.
209
+ * @param action The chat action.
210
+ * @param messageThreadId The thread to send the chat action to.
211
+ */
212
+ sendChatAction(chatId: ChatID, action_: ChatAction, messageThreadId?: number): Promise<void>;
206
213
  private handle;
207
214
  use(handler: Handler): void;
208
215
  branch(predicate: (upd: Update) => MaybePromise<boolean>, trueHandler: Handler, falseHandler: Handler): void;
209
- filter<D extends Update>(predicate: (ctx: Update) => ctx is D, handler: Handler<D>): void;
210
- filter(predicate: (ctx: Update) => MaybePromise<boolean>, handler: Handler): void;
216
+ filter<D extends Update>(predicate: (update: Update) => update is D, handler: Handler<D>): void;
217
+ filter(predicate: (update: Update) => MaybePromise<boolean>, handler: Handler): void;
211
218
  on<T extends keyof Update, F extends keyof NonNullable<Update[T]>>(filter: T extends FilterableUpdates ? T | [T, F, ...F[]] : T, handler: Handler<FilterUpdate<Update, T, F>>): void;
212
219
  }
@@ -10,6 +10,7 @@ import { checkPassword } from "./0_password.js";
10
10
  import { parseHtml } from "./0_html.js";
11
11
  import { ClientPlain } from "./2_client_plain.js";
12
12
  import { ClientAbstract } from "./1_client_abstract.js";
13
+ import { skip } from "./3_types.js";
13
14
  const d = debug("Client");
14
15
  const dGap = debug("Client/recoverUpdateGap");
15
16
  const dGapC = debug("Client/recoverChannelUpdateGap");
@@ -27,7 +28,6 @@ export class Client extends ClientAbstract {
27
28
  * @param storage The storage provider to use. Defaults to memory storage.
28
29
  * @param apiId App's API ID from [my.telegram.org](https://my.telegram.org/apps). Defaults to 0 (unset).
29
30
  * @param apiHash App's API hash from [my.telegram.org/apps](https://my.telegram.org/apps). Defaults to empty string (unset).
30
- * @param params Other parameters.
31
31
  */
32
32
  constructor(storage = new StorageMemory(), apiId = 0, apiHash = "", params) {
33
33
  super(params);
@@ -152,7 +152,7 @@ export class Client extends ClientAbstract {
152
152
  value: ((connected) => {
153
153
  this.connectMutex.acquire().then(async (release) => {
154
154
  try {
155
- const connectionState = connected ? "ready" : "not-connected";
155
+ const connectionState = connected ? "ready" : "notConnected";
156
156
  if (this.connected == connected && this.lastPropagatedConnectionState != connectionState) {
157
157
  await this.propagateConnectionState(connectionState);
158
158
  this.lastPropagatedConnectionState = connectionState;
@@ -216,9 +216,9 @@ export class Client extends ClientAbstract {
216
216
  enumerable: true,
217
217
  configurable: true,
218
218
  writable: true,
219
- value: resolve
219
+ value: skip
220
220
  });
221
- this.parseMode = params?.parseMode ?? "none";
221
+ this.parseMode = params?.parseMode ?? null;
222
222
  this.appVersion = params?.appVersion ?? APP_VERSION;
223
223
  this.deviceModel = params?.deviceModel ?? DEVICE_MODEL;
224
224
  this.langCode = params?.langCode ?? LANG_CODE;
@@ -1177,8 +1177,11 @@ export class Client extends ClientAbstract {
1177
1177
  return messages;
1178
1178
  }
1179
1179
  async resolveSendAs(params) {
1180
- await this.assertUser("sendAs");
1181
- return params?.sendAs ? await this.getInputPeer(params.sendAs) : undefined;
1180
+ const sendAs = params?.sendAs;
1181
+ if (sendAs !== undefined) {
1182
+ await this.assertUser("sendAs");
1183
+ return sendAs ? await this.getInputPeer(sendAs) : undefined;
1184
+ }
1182
1185
  }
1183
1186
  /**
1184
1187
  * Send a text message.
@@ -1216,9 +1219,9 @@ export class Client extends ClientAbstract {
1216
1219
  const entities_ = params?.entities ?? [];
1217
1220
  const parseMode = params?.parseMode ?? this.parseMode;
1218
1221
  switch (parseMode) {
1219
- case "none":
1222
+ case null:
1220
1223
  break;
1221
- case "html": {
1224
+ case "HTML": {
1222
1225
  const [newText, entitiesToPush] = parseHtml(text);
1223
1226
  text = newText;
1224
1227
  for (const entity of entitiesToPush) {
@@ -1583,6 +1586,54 @@ export class Client extends ClientAbstract {
1583
1586
  const message = await this.updatesToMessages(chatId, result).then((v) => v[0]);
1584
1587
  return Client.assertMsgHas(message, "poll");
1585
1588
  }
1589
+ /**
1590
+ * Send a chat action.
1591
+ *
1592
+ * @param chatId The chat to send the chat action to.
1593
+ * @param action The chat action.
1594
+ * @param messageThreadId The thread to send the chat action to.
1595
+ */
1596
+ async sendChatAction(chatId, action_, messageThreadId) {
1597
+ let action;
1598
+ switch (action_) {
1599
+ case "type":
1600
+ action = new types.SendMessageTypingAction();
1601
+ break;
1602
+ case "uploadPhoto":
1603
+ action = new types.SendMessageUploadPhotoAction({ progress: 0 });
1604
+ break;
1605
+ case "recordVideo":
1606
+ action = new types.SendMessageRecordVideoAction();
1607
+ break;
1608
+ case "uploadVideo":
1609
+ action = new types.SendMessageRecordVideoAction();
1610
+ break;
1611
+ case "recordVoice":
1612
+ action = new types.SendMessageRecordAudioAction();
1613
+ break;
1614
+ case "uploadAudio":
1615
+ action = new types.SendMessageUploadAudioAction({ progress: 0 });
1616
+ break;
1617
+ case "uploadDocument":
1618
+ action = new types.SendMessageUploadDocumentAction({ progress: 0 });
1619
+ break;
1620
+ case "chooseSticker":
1621
+ action = new types.SendMessageChooseStickerAction();
1622
+ break;
1623
+ case "findLocation":
1624
+ action = new types.SendMessageGeoLocationAction();
1625
+ break;
1626
+ case "recordVideoNote":
1627
+ action = new types.SendMessageRecordRoundAction();
1628
+ break;
1629
+ case "uploadVideoNote":
1630
+ action = new types.SendMessageUploadRoundAction({ progress: 0 });
1631
+ break;
1632
+ default:
1633
+ throw new Error("Invalid chat action: " + action_);
1634
+ }
1635
+ await this.invoke(new functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action, topMsgId: messageThreadId }));
1636
+ }
1586
1637
  use(handler) {
1587
1638
  const handle = this.handle;
1588
1639
  this.handle = async (upd, next) => {
@@ -1606,7 +1657,7 @@ export class Client extends ClientAbstract {
1606
1657
  });
1607
1658
  }
1608
1659
  filter(predicate, handler) {
1609
- this.branch(predicate, handler, resolve);
1660
+ this.branch(predicate, handler, skip);
1610
1661
  }
1611
1662
  on(filter, handler) {
1612
1663
  const type = typeof filter === "string" ? filter : filter[0];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Make an assertion that `actual` is greater than `expected`.
3
+ * If not then throw.
4
+ */
5
+ export declare function assertGreater<T>(actual: T, expected: T, msg?: string): void;
@@ -0,0 +1,14 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import { format } from "./_format.js";
3
+ import { AssertionError } from "./assertion_error.js";
4
+ /**
5
+ * Make an assertion that `actual` is greater than `expected`.
6
+ * If not then throw.
7
+ */
8
+ export function assertGreater(actual, expected, msg) {
9
+ if (actual > expected)
10
+ return;
11
+ const actualString = format(actual);
12
+ const expectedString = format(expected);
13
+ throw new AssertionError(msg ?? `Expect ${actualString} > ${expectedString}`);
14
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Make an assertion that `actual` is greater than or equal to `expected`.
3
+ * If not then throw.
4
+ */
5
+ export declare function assertGreaterOrEqual<T>(actual: T, expected: T, msg?: string): void;
@@ -0,0 +1,14 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import { format } from "./_format.js";
3
+ import { AssertionError } from "./assertion_error.js";
4
+ /**
5
+ * Make an assertion that `actual` is greater than or equal to `expected`.
6
+ * If not then throw.
7
+ */
8
+ export function assertGreaterOrEqual(actual, expected, msg) {
9
+ if (actual >= expected)
10
+ return;
11
+ const actualString = format(actual);
12
+ const expectedString = format(expected);
13
+ throw new AssertionError(msg ?? `Expect ${actualString} >= ${expectedString}`);
14
+ }
@@ -22,11 +22,11 @@ export function assertInstanceOf(actual, expectedType, msg = "") {
22
22
  else {
23
23
  actualTypeStr = typeof actual;
24
24
  }
25
- if (expectedTypeStr == actualTypeStr) {
25
+ if (expectedTypeStr === actualTypeStr) {
26
26
  msg =
27
27
  `Expected object to be an instance of "${expectedTypeStr}"${msgSuffix}`;
28
28
  }
29
- else if (actualTypeStr == "function") {
29
+ else if (actualTypeStr === "function") {
30
30
  msg =
31
31
  `Expected object to be an instance of "${expectedTypeStr}" but was not an instanced object${msgSuffix}`;
32
32
  }
@@ -20,7 +20,10 @@ ErrorClass, msgIncludes, msg) {
20
20
  }
21
21
  if (msgIncludes && (!(error instanceof Error) ||
22
22
  !stripColor(error.message).includes(stripColor(msgIncludes)))) {
23
- msg = `Expected error message to include "${msgIncludes}", but got "${error instanceof Error ? error.message : "[not an Error]"}"${msgSuffix}`;
23
+ msg = `Expected error message to include ${JSON.stringify(msgIncludes)}, but got ${error instanceof Error
24
+ ? JSON.stringify(error.message)
25
+ : '"[not an Error]"' // TODO(kt3k): show more useful information
26
+ }${msgSuffix}`;
24
27
  throw new AssertionError(msg);
25
28
  }
26
29
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Make an assertion that `actual` is less than `expected`.
3
+ * If not then throw.
4
+ */
5
+ export declare function assertLess<T>(actual: T, expected: T, msg?: string): void;
@@ -0,0 +1,14 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import { format } from "./_format.js";
3
+ import { AssertionError } from "./assertion_error.js";
4
+ /**
5
+ * Make an assertion that `actual` is less than `expected`.
6
+ * If not then throw.
7
+ */
8
+ export function assertLess(actual, expected, msg) {
9
+ if (actual < expected)
10
+ return;
11
+ const actualString = format(actual);
12
+ const expectedString = format(expected);
13
+ throw new AssertionError(msg ?? `Expect ${actualString} < ${expectedString}`);
14
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Make an assertion that `actual` is less than or equal to `expected`.
3
+ * If not then throw.
4
+ */
5
+ export declare function assertLessOrEqual<T>(actual: T, expected: T, msg?: string): void;
@@ -0,0 +1,14 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ import { format } from "./_format.js";
3
+ import { AssertionError } from "./assertion_error.js";
4
+ /**
5
+ * Make an assertion that `actual` is less than or equal to `expected`.
6
+ * If not then throw.
7
+ */
8
+ export function assertLessOrEqual(actual, expected, msg) {
9
+ if (actual <= expected)
10
+ return;
11
+ const actualString = format(actual);
12
+ const expectedString = format(expected);
13
+ throw new AssertionError(msg ?? `Expect ${actualString} <= ${expectedString}`);
14
+ }
@@ -12,8 +12,12 @@ export * from "./assert_array_includes.js";
12
12
  export * from "./assert_equals.js";
13
13
  export * from "./assert_exists.js";
14
14
  export * from "./assert_false.js";
15
+ export * from "./assert_greater_or_equal.js";
16
+ export * from "./assert_greater.js";
15
17
  export * from "./assert_instance_of.js";
16
18
  export * from "./assert_is_error.js";
19
+ export * from "./assert_less_or_equal.js";
20
+ export * from "./assert_less.js";
17
21
  export * from "./assert_match.js";
18
22
  export * from "./assert_not_equals.js";
19
23
  export * from "./assert_not_instance_of.js";
@@ -13,8 +13,12 @@ export * from "./assert_array_includes.js";
13
13
  export * from "./assert_equals.js";
14
14
  export * from "./assert_exists.js";
15
15
  export * from "./assert_false.js";
16
+ export * from "./assert_greater_or_equal.js";
17
+ export * from "./assert_greater.js";
16
18
  export * from "./assert_instance_of.js";
17
19
  export * from "./assert_is_error.js";
20
+ export * from "./assert_less_or_equal.js";
21
+ export * from "./assert_less.js";
18
22
  export * from "./assert_match.js";
19
23
  export * from "./assert_not_equals.js";
20
24
  export * from "./assert_not_instance_of.js";
@@ -262,9 +262,16 @@ export declare function rgb24(str: string, color: number | Rgb): string;
262
262
  * @param color code
263
263
  */
264
264
  export declare function bgRgb24(str: string, color: number | Rgb): string;
265
+ /**
266
+ * @deprecated (will be removed in 1.0.0) Use `stripAnsiCode` instead.
267
+ *
268
+ * Remove ANSI escape codes from the string.
269
+ * @param string to remove ANSI escape codes from
270
+ */
271
+ export declare const stripColor: typeof stripAnsiCode;
265
272
  /**
266
273
  * Remove ANSI escape codes from the string.
267
274
  * @param string to remove ANSI escape codes from
268
275
  */
269
- export declare function stripColor(string: string): string;
276
+ export declare function stripAnsiCode(string: string): string;
270
277
  export {};
@@ -465,10 +465,17 @@ const ANSI_PATTERN = new RegExp([
465
465
  "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
466
466
  "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))",
467
467
  ].join("|"), "g");
468
+ /**
469
+ * @deprecated (will be removed in 1.0.0) Use `stripAnsiCode` instead.
470
+ *
471
+ * Remove ANSI escape codes from the string.
472
+ * @param string to remove ANSI escape codes from
473
+ */
474
+ export const stripColor = stripAnsiCode;
468
475
  /**
469
476
  * Remove ANSI escape codes from the string.
470
477
  * @param string to remove ANSI escape codes from
471
478
  */
472
- export function stripColor(string) {
479
+ export function stripAnsiCode(string) {
473
480
  return string.replace(ANSI_PATTERN, "");
474
481
  }
@@ -1,6 +1,6 @@
1
1
  import { TLRawReader } from "./0_tl_raw_reader.js";
2
2
  import { TLObject } from "./1_tl_object.js";
3
- export type ReadObject = TLObject | Array<ReadObject | TLObject>;
3
+ export type ReadObject = boolean | TLObject | Array<ReadObject | TLObject>;
4
4
  export declare class TLReader extends TLRawReader {
5
5
  readObject(id?: number): ReadObject;
6
6
  }
@@ -15,6 +15,12 @@ export class TLReader extends TLRawReader {
15
15
  }
16
16
  return items;
17
17
  }
18
+ else if (id == 0x997275b5) {
19
+ return true;
20
+ }
21
+ else if (id == 0xbc799737) {
22
+ return false;
23
+ }
18
24
  const constructor = map.get(id);
19
25
  if (constructor) {
20
26
  return deserialize(this, constructor[paramDesc], constructor);
@@ -10,6 +10,14 @@ export class TLWriter extends TLRawWriter {
10
10
  this.writeObject(item);
11
11
  }
12
12
  }
13
+ else if (typeof object === "boolean") {
14
+ if (object) {
15
+ this.writeInt32(0x997275b5, false);
16
+ }
17
+ else {
18
+ this.writeInt32(0xbc799737, false);
19
+ }
20
+ }
13
21
  else {
14
22
  this.write(object[serialize]());
15
23
  }
@@ -12,6 +12,9 @@ function calculateLength(object) {
12
12
  length += calculateLength(item);
13
13
  }
14
14
  }
15
+ else if (typeof object === "boolean") {
16
+ length += 32 / 8; // constructor
17
+ }
15
18
  else {
16
19
  length += object[serialize]().length;
17
20
  }
@@ -0,0 +1 @@
1
+ export type ChatAction = "type" | "uploadPhoto" | "recordVideo" | "uploadVideo" | "recordVoice" | "uploadAudio" | "uploadDocument" | "chooseSticker" | "findLocation" | "recordVideoNote" | "uploadVideoNote";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { types } from "../2_tl.js";
2
- export type MessageEntityType = "mention" | "hashtag" | "bot_command" | "url" | "email" | "bold" | "italic" | "code" | "pre" | "text_link" | "text_mention" | "cashtag" | "phone_number" | "underline" | "strikethrough" | "blockquote" | "bank_card" | "spoiler" | "custom_emoji";
2
+ export type MessageEntityType = "mention" | "hashtag" | "botCommand" | "url" | "email" | "bold" | "italic" | "code" | "pre" | "textLink" | "textMention" | "cashtag" | "phoneNumber" | "underline" | "strikethrough" | "blockquote" | "bankCard" | "spoiler" | "customEmoji";
3
3
  export declare namespace MessageEntity {
4
4
  interface Base {
5
5
  type: MessageEntityType;
@@ -15,7 +15,7 @@ export declare namespace MessageEntity {
15
15
  type: "hashtag";
16
16
  }
17
17
  interface BotCommand extends Base {
18
- type: "bot_command";
18
+ type: "botCommand";
19
19
  }
20
20
  interface URL extends Base {
21
21
  type: "url";
@@ -38,20 +38,20 @@ export declare namespace MessageEntity {
38
38
  type: "code";
39
39
  }
40
40
  interface TextLink extends Base {
41
- type: "text_link";
42
- /** For "text_link" only, URL that will be opened after user taps on the text */
41
+ type: "textLink";
42
+ /** For "textLink" only, URL that will be opened after user taps on the text */
43
43
  url: string;
44
44
  }
45
45
  interface TextMention extends Base {
46
- type: "text_mention";
47
- /** For "text_mention" only, the ID of the mentioned user */
46
+ type: "textMention";
47
+ /** For "textMention" only, the ID of the mentioned user */
48
48
  userId: number;
49
49
  }
50
50
  interface Cashtag extends Base {
51
51
  type: "cashtag";
52
52
  }
53
53
  interface PhoneNumber extends Base {
54
- type: "phone_number";
54
+ type: "phoneNumber";
55
55
  }
56
56
  interface Underline extends Base {
57
57
  type: "underline";
@@ -63,14 +63,14 @@ export declare namespace MessageEntity {
63
63
  type: "blockquote";
64
64
  }
65
65
  interface BankCard extends Base {
66
- type: "bank_card";
66
+ type: "bankCard";
67
67
  }
68
68
  interface Spoiler extends Base {
69
69
  type: "spoiler";
70
70
  }
71
71
  interface CustomEmoji extends Base {
72
- type: "custom_emoji";
73
- /** For "custom_emoji" only, unique identifier of the custom emoji */
72
+ type: "customEmoji";
73
+ /** For "customEmoji" only, unique identifier of the custom emoji */
74
74
  customEmojiId: string;
75
75
  }
76
76
  }