@mtkruto/node 0.0.997 → 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.
- package/esm/0_deps.d.ts +2 -2
- package/esm/0_deps.js +2 -2
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/client/0_html.js +1 -1
- package/esm/client/3_types.d.ts +2 -1
- package/esm/client/3_types.js +1 -1
- package/esm/client/4_client.d.ts +2 -3
- package/esm/client/4_client.js +19 -19
- package/esm/deps/deno.land/std@0.201.0/assert/assert_greater.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assert_greater.js +14 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.js +14 -0
- package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.js +2 -2
- package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.js +4 -1
- package/esm/deps/deno.land/std@0.201.0/assert/assert_less.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assert_less.js +14 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.d.ts +5 -0
- package/esm/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.js +14 -0
- package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.d.ts +4 -0
- package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.js +4 -0
- package/{script/deps/deno.land/std@0.200.0 → esm/deps/deno.land/std@0.201.0}/fmt/colors.d.ts +8 -1
- package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/fmt/colors.js +8 -1
- package/esm/tl/3_tl_reader.d.ts +1 -1
- package/esm/tl/3_tl_reader.js +6 -0
- package/esm/tl/4_tl_writer.js +8 -0
- package/esm/tl/6_message.js +3 -0
- package/esm/types/0_chat_action.d.ts +1 -1
- package/esm/types/0_message_entity.d.ts +10 -10
- package/esm/types/0_message_entity.js +12 -12
- package/esm/types/1_chat.d.ts +5 -10
- package/esm/types/1_chat.js +4 -11
- package/esm/types/1_sticker.d.ts +2 -2
- package/esm/types/1_sticker.js +1 -1
- package/esm/types/3_message.js +3 -3
- package/package.json +1 -1
- package/script/0_deps.d.ts +2 -2
- package/script/0_deps.js +2 -2
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/client/0_html.js +1 -1
- package/script/client/3_types.d.ts +2 -1
- package/script/client/3_types.js +3 -0
- package/script/client/4_client.d.ts +2 -3
- package/script/client/4_client.js +19 -19
- package/script/deps/deno.land/std@0.201.0/assert/assert_greater.d.ts +5 -0
- package/script/deps/deno.land/std@0.201.0/assert/assert_greater.js +18 -0
- package/script/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.d.ts +5 -0
- package/script/deps/deno.land/std@0.201.0/assert/assert_greater_or_equal.js +18 -0
- package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.js +2 -2
- package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.js +4 -1
- package/script/deps/deno.land/std@0.201.0/assert/assert_less.d.ts +5 -0
- package/script/deps/deno.land/std@0.201.0/assert/assert_less.js +18 -0
- package/script/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.d.ts +5 -0
- package/script/deps/deno.land/std@0.201.0/assert/assert_less_or_equal.js +18 -0
- package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.d.ts +4 -0
- package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/mod.js +4 -0
- package/{esm/deps/deno.land/std@0.200.0 → script/deps/deno.land/std@0.201.0}/fmt/colors.d.ts +8 -1
- package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/fmt/colors.js +10 -3
- package/script/tl/3_tl_reader.d.ts +1 -1
- package/script/tl/3_tl_reader.js +6 -0
- package/script/tl/4_tl_writer.js +8 -0
- package/script/tl/6_message.js +3 -0
- package/script/types/0_chat_action.d.ts +1 -1
- package/script/types/0_message_entity.d.ts +10 -10
- package/script/types/0_message_entity.js +12 -12
- package/script/types/1_chat.d.ts +5 -10
- package/script/types/1_chat.js +5 -12
- package/script/types/1_sticker.d.ts +2 -2
- package/script/types/1_sticker.js +1 -1
- package/script/types/3_message.js +2 -2
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.js +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/encoding/base64.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.200.0 → std@0.201.0}/encoding/base64.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_constants.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_diff.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/_format.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_almost_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_array_includes.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_exists.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_false.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_instance_of.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_is_error.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_match.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_instance_of.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_match.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_not_strict_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_object_match.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_rejects.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_strict_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_string_includes.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assert_throws.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/assertion_error.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/equal.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/fail.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unimplemented.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/assert/unreachable.js +0 -0
- /package/script/deps/deno.land/{std@0.200.0 → std@0.201.0}/encoding/base64.d.ts +0 -0
- /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.
|
|
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.
|
|
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.
|
|
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.
|
|
8
|
+
export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.201.0/encoding/base64.js";
|
package/esm/4_constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
|
|
|
5
5
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
6
6
|
export declare const INITIAL_DC: DC;
|
|
7
7
|
export declare const LAYER = 161;
|
|
8
|
-
export declare const APP_VERSION = "MTKruto 0.0.
|
|
8
|
+
export declare const APP_VERSION = "MTKruto 0.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 = "";
|
package/esm/4_constants.js
CHANGED
|
@@ -54,7 +54,7 @@ export const PUBLIC_KEYS = Object.freeze([
|
|
|
54
54
|
export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
55
55
|
export const INITIAL_DC = "2-test";
|
|
56
56
|
export const LAYER = 161;
|
|
57
|
-
export const APP_VERSION = "MTKruto 0.0.
|
|
57
|
+
export const APP_VERSION = "MTKruto 0.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];
|
package/esm/client/0_html.js
CHANGED
|
@@ -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: "
|
|
30
|
+
queue.push({ type: "textLink", offset: text.length, length: 0, url });
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
33
|
case "ins":
|
package/esm/client/3_types.d.ts
CHANGED
|
@@ -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 = "
|
|
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`.
|
|
@@ -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;
|
package/esm/client/3_types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const skip = (__, _) => _();
|
package/esm/client/4_client.d.ts
CHANGED
|
@@ -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;
|
|
@@ -214,7 +213,7 @@ export declare class Client extends ClientAbstract {
|
|
|
214
213
|
private handle;
|
|
215
214
|
use(handler: Handler): void;
|
|
216
215
|
branch(predicate: (upd: Update) => MaybePromise<boolean>, trueHandler: Handler, falseHandler: Handler): void;
|
|
217
|
-
filter<D extends Update>(predicate: (
|
|
218
|
-
filter(predicate: (
|
|
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;
|
|
219
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;
|
|
220
219
|
}
|
package/esm/client/4_client.js
CHANGED
|
@@ -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);
|
|
@@ -216,11 +216,9 @@ export class Client extends ClientAbstract {
|
|
|
216
216
|
enumerable: true,
|
|
217
217
|
configurable: true,
|
|
218
218
|
writable: true,
|
|
219
|
-
value:
|
|
220
|
-
return n();
|
|
221
|
-
}
|
|
219
|
+
value: skip
|
|
222
220
|
});
|
|
223
|
-
this.parseMode = params?.parseMode ??
|
|
221
|
+
this.parseMode = params?.parseMode ?? null;
|
|
224
222
|
this.appVersion = params?.appVersion ?? APP_VERSION;
|
|
225
223
|
this.deviceModel = params?.deviceModel ?? DEVICE_MODEL;
|
|
226
224
|
this.langCode = params?.langCode ?? LANG_CODE;
|
|
@@ -1221,9 +1219,9 @@ export class Client extends ClientAbstract {
|
|
|
1221
1219
|
const entities_ = params?.entities ?? [];
|
|
1222
1220
|
const parseMode = params?.parseMode ?? this.parseMode;
|
|
1223
1221
|
switch (parseMode) {
|
|
1224
|
-
case
|
|
1222
|
+
case null:
|
|
1225
1223
|
break;
|
|
1226
|
-
case "
|
|
1224
|
+
case "HTML": {
|
|
1227
1225
|
const [newText, entitiesToPush] = parseHtml(text);
|
|
1228
1226
|
text = newText;
|
|
1229
1227
|
for (const entity of entitiesToPush) {
|
|
@@ -1598,39 +1596,41 @@ export class Client extends ClientAbstract {
|
|
|
1598
1596
|
async sendChatAction(chatId, action_, messageThreadId) {
|
|
1599
1597
|
let action;
|
|
1600
1598
|
switch (action_) {
|
|
1601
|
-
case "
|
|
1599
|
+
case "type":
|
|
1602
1600
|
action = new types.SendMessageTypingAction();
|
|
1603
1601
|
break;
|
|
1604
|
-
case "
|
|
1602
|
+
case "uploadPhoto":
|
|
1605
1603
|
action = new types.SendMessageUploadPhotoAction({ progress: 0 });
|
|
1606
1604
|
break;
|
|
1607
|
-
case "
|
|
1605
|
+
case "recordVideo":
|
|
1608
1606
|
action = new types.SendMessageRecordVideoAction();
|
|
1609
1607
|
break;
|
|
1610
|
-
case "
|
|
1608
|
+
case "uploadVideo":
|
|
1611
1609
|
action = new types.SendMessageRecordVideoAction();
|
|
1612
1610
|
break;
|
|
1613
|
-
case "
|
|
1611
|
+
case "recordVoice":
|
|
1614
1612
|
action = new types.SendMessageRecordAudioAction();
|
|
1615
1613
|
break;
|
|
1616
|
-
case "
|
|
1614
|
+
case "uploadAudio":
|
|
1617
1615
|
action = new types.SendMessageUploadAudioAction({ progress: 0 });
|
|
1618
1616
|
break;
|
|
1619
|
-
case "
|
|
1617
|
+
case "uploadDocument":
|
|
1620
1618
|
action = new types.SendMessageUploadDocumentAction({ progress: 0 });
|
|
1621
1619
|
break;
|
|
1622
|
-
case "
|
|
1620
|
+
case "chooseSticker":
|
|
1623
1621
|
action = new types.SendMessageChooseStickerAction();
|
|
1624
1622
|
break;
|
|
1625
|
-
case "
|
|
1623
|
+
case "findLocation":
|
|
1626
1624
|
action = new types.SendMessageGeoLocationAction();
|
|
1627
1625
|
break;
|
|
1628
|
-
case "
|
|
1626
|
+
case "recordVideoNote":
|
|
1629
1627
|
action = new types.SendMessageRecordRoundAction();
|
|
1630
1628
|
break;
|
|
1631
|
-
case "
|
|
1629
|
+
case "uploadVideoNote":
|
|
1632
1630
|
action = new types.SendMessageUploadRoundAction({ progress: 0 });
|
|
1633
1631
|
break;
|
|
1632
|
+
default:
|
|
1633
|
+
throw new Error("Invalid chat action: " + action_);
|
|
1634
1634
|
}
|
|
1635
1635
|
await this.invoke(new functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action, topMsgId: messageThreadId }));
|
|
1636
1636
|
}
|
|
@@ -1657,7 +1657,7 @@ export class Client extends ClientAbstract {
|
|
|
1657
1657
|
});
|
|
1658
1658
|
}
|
|
1659
1659
|
filter(predicate, handler) {
|
|
1660
|
-
this.branch(predicate, handler,
|
|
1660
|
+
this.branch(predicate, handler, skip);
|
|
1661
1661
|
}
|
|
1662
1662
|
on(filter, handler) {
|
|
1663
1663
|
const type = typeof filter === "string" ? filter : filter[0];
|
|
@@ -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,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
|
|
25
|
+
if (expectedTypeStr === actualTypeStr) {
|
|
26
26
|
msg =
|
|
27
27
|
`Expected object to be an instance of "${expectedTypeStr}"${msgSuffix}`;
|
|
28
28
|
}
|
|
29
|
-
else if (actualTypeStr
|
|
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
|
|
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,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,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";
|
package/{script/deps/deno.land/std@0.200.0 → esm/deps/deno.land/std@0.201.0}/fmt/colors.d.ts
RENAMED
|
@@ -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
|
|
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
|
|
479
|
+
export function stripAnsiCode(string) {
|
|
473
480
|
return string.replace(ANSI_PATTERN, "");
|
|
474
481
|
}
|
package/esm/tl/3_tl_reader.d.ts
CHANGED
|
@@ -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
|
}
|
package/esm/tl/3_tl_reader.js
CHANGED
|
@@ -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);
|
package/esm/tl/4_tl_writer.js
CHANGED
|
@@ -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
|
}
|
package/esm/tl/6_message.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ChatAction = "
|
|
1
|
+
export type ChatAction = "type" | "uploadPhoto" | "recordVideo" | "uploadVideo" | "recordVoice" | "uploadAudio" | "uploadDocument" | "chooseSticker" | "findLocation" | "recordVideoNote" | "uploadVideoNote";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
-
export type MessageEntityType = "mention" | "hashtag" | "
|
|
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: "
|
|
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: "
|
|
42
|
-
/** For "
|
|
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: "
|
|
47
|
-
/** For "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
73
|
-
/** For "
|
|
72
|
+
type: "customEmoji";
|
|
73
|
+
/** For "customEmoji" only, unique identifier of the custom emoji */
|
|
74
74
|
customEmojiId: string;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -7,7 +7,7 @@ export function constructMessageEntity(obj) {
|
|
|
7
7
|
return { type: "hashtag", offset: obj.offset, length: obj.length };
|
|
8
8
|
}
|
|
9
9
|
else if (obj instanceof types.MessageEntityBotCommand) {
|
|
10
|
-
return { type: "
|
|
10
|
+
return { type: "botCommand", offset: obj.offset ?? 0, length: obj.length };
|
|
11
11
|
}
|
|
12
12
|
else if (obj instanceof types.MessageEntityURL) {
|
|
13
13
|
return { type: "url", offset: obj.offset, length: obj.length };
|
|
@@ -28,16 +28,16 @@ export function constructMessageEntity(obj) {
|
|
|
28
28
|
return { type: "pre", offset: obj.offset, length: obj.length, language: obj.language };
|
|
29
29
|
}
|
|
30
30
|
else if (obj instanceof types.MessageEntityTextURL) {
|
|
31
|
-
return { type: "
|
|
31
|
+
return { type: "textLink", offset: obj.offset, length: obj.length, url: obj.url };
|
|
32
32
|
}
|
|
33
33
|
else if (obj instanceof types.MessageEntityMentionName) {
|
|
34
|
-
return { type: "
|
|
34
|
+
return { type: "textMention", offset: obj.offset, length: obj.length, userId: Number(obj.userId) };
|
|
35
35
|
}
|
|
36
36
|
else if (obj instanceof types.MessageEntityCashtag) {
|
|
37
37
|
return { type: "cashtag", offset: obj.offset, length: obj.length };
|
|
38
38
|
}
|
|
39
39
|
else if (obj instanceof types.MessageEntityPhone) {
|
|
40
|
-
return { type: "
|
|
40
|
+
return { type: "phoneNumber", offset: obj.offset, length: obj.length };
|
|
41
41
|
}
|
|
42
42
|
else if (obj instanceof types.MessageEntityUnderline) {
|
|
43
43
|
return { type: "underline", offset: obj.offset, length: obj.length };
|
|
@@ -49,13 +49,13 @@ export function constructMessageEntity(obj) {
|
|
|
49
49
|
return { type: "blockquote", offset: obj.offset, length: obj.length };
|
|
50
50
|
}
|
|
51
51
|
else if (obj instanceof types.MessageEntityBankCard) {
|
|
52
|
-
return { type: "
|
|
52
|
+
return { type: "bankCard", offset: obj.offset, length: obj.length };
|
|
53
53
|
}
|
|
54
54
|
else if (obj instanceof types.MessageEntitySpoiler) {
|
|
55
55
|
return { type: "spoiler", offset: obj.offset, length: obj.length };
|
|
56
56
|
}
|
|
57
57
|
else if (obj instanceof types.MessageEntityCustomEmoji) {
|
|
58
|
-
return { type: "
|
|
58
|
+
return { type: "customEmoji", offset: obj.offset, length: obj.length, customEmojiId: String(obj.documentId) };
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
return null;
|
|
@@ -68,7 +68,7 @@ export function messageEntityToTlObject(entity) {
|
|
|
68
68
|
return new types.MessageEntityMention({ offset, length });
|
|
69
69
|
case "hashtag":
|
|
70
70
|
return new types.MessageEntityHashtag({ offset, length });
|
|
71
|
-
case "
|
|
71
|
+
case "botCommand":
|
|
72
72
|
return new types.MessageEntityBotCommand({ offset, length });
|
|
73
73
|
case "url":
|
|
74
74
|
return new types.MessageEntityURL({ offset, length });
|
|
@@ -82,13 +82,13 @@ export function messageEntityToTlObject(entity) {
|
|
|
82
82
|
return new types.MessageEntityCode({ offset, length });
|
|
83
83
|
case "pre":
|
|
84
84
|
return new types.MessageEntityPre({ offset, length, language: entity.language });
|
|
85
|
-
case "
|
|
85
|
+
case "textLink":
|
|
86
86
|
return new types.MessageEntityTextURL({ offset, length, url: entity.url });
|
|
87
|
-
case "
|
|
87
|
+
case "textMention":
|
|
88
88
|
return new types.MessageEntityMentionName({ offset, length, userId: BigInt(entity.userId) });
|
|
89
89
|
case "cashtag":
|
|
90
90
|
return new types.MessageEntityCashtag({ offset, length });
|
|
91
|
-
case "
|
|
91
|
+
case "phoneNumber":
|
|
92
92
|
return new types.MessageEntityPhone({ offset, length });
|
|
93
93
|
case "underline":
|
|
94
94
|
return new types.MessageEntityUnderline({ offset, length });
|
|
@@ -96,11 +96,11 @@ export function messageEntityToTlObject(entity) {
|
|
|
96
96
|
return new types.MessageEntityStrike({ offset, length });
|
|
97
97
|
case "blockquote":
|
|
98
98
|
return new types.MessageEntityBlockquote({ offset, length });
|
|
99
|
-
case "
|
|
99
|
+
case "bankCard":
|
|
100
100
|
return new types.MessageEntityBankCard({ offset, length });
|
|
101
101
|
case "spoiler":
|
|
102
102
|
return new types.MessageEntitySpoiler({ offset, length });
|
|
103
|
-
case "
|
|
103
|
+
case "customEmoji":
|
|
104
104
|
return new types.MessageEntityCustomEmoji({ offset, length, documentId: BigInt(entity.customEmojiId) });
|
|
105
105
|
}
|
|
106
106
|
}
|
package/esm/types/1_chat.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
2
|
import { Color } from "./0_color.js";
|
|
3
3
|
import { ChatPhoto } from "./0_chat_photo.js";
|
|
4
|
-
export
|
|
5
|
-
Private = "private",
|
|
6
|
-
Group = "group",
|
|
7
|
-
Supergroup = "supergroup",
|
|
8
|
-
Channel = "channel"
|
|
9
|
-
}
|
|
4
|
+
export type ChatType = "private" | "group" | "supergroup" | "channel";
|
|
10
5
|
export declare namespace Chat {
|
|
11
6
|
interface Base {
|
|
12
7
|
/** Type of chat, can be either "private", "group", "supergroup" or "channel" */
|
|
@@ -18,7 +13,7 @@ export declare namespace Chat {
|
|
|
18
13
|
photo?: ChatPhoto;
|
|
19
14
|
}
|
|
20
15
|
interface Private extends Base {
|
|
21
|
-
type:
|
|
16
|
+
type: "private";
|
|
22
17
|
/** True, if this user is a bot */
|
|
23
18
|
isBot?: boolean;
|
|
24
19
|
/** First name of the other party in a private chat */
|
|
@@ -45,7 +40,7 @@ export declare namespace Chat {
|
|
|
45
40
|
restrictionReason?: types.RestrictionReason[];
|
|
46
41
|
}
|
|
47
42
|
interface Group extends Base {
|
|
48
|
-
type:
|
|
43
|
+
type: "group";
|
|
49
44
|
/** Title, for supergroups, channels and group chats */
|
|
50
45
|
title: string;
|
|
51
46
|
/** Chat photo. */
|
|
@@ -74,7 +69,7 @@ export declare namespace Chat {
|
|
|
74
69
|
restrictionReason?: types.RestrictionReason[];
|
|
75
70
|
}
|
|
76
71
|
interface Channel extends ChannelBase {
|
|
77
|
-
type:
|
|
72
|
+
type: "channel";
|
|
78
73
|
/** Title, for supergroups, channels and group chats */
|
|
79
74
|
title: string;
|
|
80
75
|
/** Username, for private chats, supergroups and channels if available */
|
|
@@ -83,7 +78,7 @@ export declare namespace Chat {
|
|
|
83
78
|
also?: string[];
|
|
84
79
|
}
|
|
85
80
|
interface Supergroup extends ChannelBase {
|
|
86
|
-
type:
|
|
81
|
+
type: "supergroup";
|
|
87
82
|
/** True, if the supergroup chat is a forum (has [topics](https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups) enabled) */
|
|
88
83
|
isForum: boolean;
|
|
89
84
|
}
|