@mtkruto/node 0.0.991 → 0.0.992
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/1_utilities.d.ts +12 -0
- package/esm/1_utilities.js +12 -0
- package/esm/2_connection.d.ts +2 -0
- package/esm/2_connection.js +2 -0
- package/esm/2_tl.d.ts +10 -0
- package/esm/2_tl.js +10 -0
- package/esm/3_storage.d.ts +6 -0
- package/esm/3_storage.js +6 -0
- package/esm/3_transport.d.ts +4 -0
- package/esm/3_transport.js +4 -0
- package/esm/3_types.d.ts +35 -0
- package/esm/3_types.js +35 -0
- package/esm/{constants.d.ts → 4_constants.d.ts} +2 -2
- package/esm/{constants.js → 4_constants.js} +1 -1
- package/esm/5_client.d.ts +2 -0
- package/esm/5_client.js +2 -0
- package/esm/client/0_html.d.ts +1 -1
- package/esm/client/0_html.js +1 -1
- package/esm/client/0_message.d.ts +1 -2
- package/esm/client/0_message.js +7 -14
- package/esm/client/0_password.d.ts +2 -2
- package/esm/client/0_password.js +2 -4
- package/esm/client/0_utilities.d.ts +3 -5
- package/esm/client/0_utilities.js +3 -22
- package/esm/client/1_client_abstract.d.ts +2 -2
- package/esm/client/1_client_abstract.js +3 -3
- package/esm/client/2_client_plain.d.ts +3 -3
- package/esm/client/2_client_plain.js +13 -20
- package/esm/client/3_client.d.ts +33 -18
- package/esm/client/3_client.js +47 -35
- package/esm/connection/0_connection.d.ts +1 -1
- package/esm/connection/1_connection_web_socket.js +1 -1
- package/esm/mod.d.ts +7 -21
- package/esm/mod.js +7 -21
- package/esm/storage/0_storage.d.ts +4 -5
- package/esm/storage/0_storage.js +3 -8
- package/esm/storage/0_utilities.js +2 -2
- package/esm/storage/1_storage_local_storage.d.ts +1 -1
- package/esm/storage/1_storage_memory.d.ts +1 -1
- package/esm/storage/1_storage_session_storage.d.ts +1 -1
- package/esm/tl/0_tl_raw_reader.js +1 -1
- package/esm/tl/0_tl_raw_writer.js +1 -1
- package/esm/tl/1_tl_object.js +1 -1
- package/esm/tl/3_deserialize.js +1 -1
- package/esm/tl/3_utilities.d.ts +3 -0
- package/esm/tl/3_utilities.js +20 -0
- package/esm/tl/4_tl_writer.js +1 -1
- package/esm/transport/0_obfuscation.d.ts +2 -2
- package/esm/transport/0_obfuscation.js +1 -2
- package/esm/transport/0_transport.d.ts +1 -2
- package/esm/transport/1_transport_abridged.d.ts +1 -1
- package/esm/transport/1_transport_abridged.js +1 -1
- package/esm/transport/1_transport_intermediate.d.ts +1 -1
- package/esm/transport/1_transport_intermediate.js +1 -1
- package/esm/transport/2_transport_provider.d.ts +1 -1
- package/esm/transport/2_transport_provider.js +1 -1
- package/esm/types/!0_file_id.js +6 -9
- package/esm/types/!0_misc.d.ts +7 -0
- package/esm/types/!0_misc.js +1 -0
- package/esm/types/0_audio.d.ts +3 -3
- package/esm/types/0_audio.js +1 -1
- package/esm/types/0_chat_administrator_rights.d.ts +1 -1
- package/esm/types/0_chat_administrator_rights.js +1 -1
- package/esm/types/0_chat_photo.d.ts +3 -3
- package/esm/types/0_chat_photo.js +1 -1
- package/esm/types/0_color.d.ts +2 -0
- package/esm/types/0_color.js +16 -0
- package/esm/types/0_contact.d.ts +2 -2
- package/esm/types/0_dice.d.ts +1 -1
- package/esm/types/0_force_reply.d.ts +1 -1
- package/esm/types/0_force_reply.js +1 -1
- package/esm/types/0_location.d.ts +1 -1
- package/esm/types/0_location.js +1 -2
- package/esm/types/0_mask_position.d.ts +1 -1
- package/esm/types/0_message_entity.d.ts +5 -5
- package/esm/types/0_message_entity.js +1 -1
- package/esm/types/0_poll_option.d.ts +1 -1
- package/esm/types/0_reply_keyboard_remove.d.ts +1 -1
- package/esm/types/0_reply_keyboard_remove.js +2 -2
- package/esm/types/0_thumbnail.d.ts +2 -2
- package/esm/types/0_thumbnail.js +1 -1
- package/esm/types/0_venue.d.ts +1 -1
- package/esm/types/0_venue.js +1 -2
- package/esm/types/0_voice.d.ts +3 -3
- package/esm/types/0_web_app_info.d.ts +2 -2
- package/esm/types/1_animation.d.ts +3 -3
- package/esm/types/1_animation.js +1 -1
- package/esm/types/1_chat.d.ts +5 -4
- package/esm/types/1_chat.js +8 -9
- package/esm/types/1_document.d.ts +4 -4
- package/esm/types/1_document.js +1 -1
- package/esm/types/1_inline_keyboard_button.d.ts +4 -4
- package/esm/types/1_inline_keyboard_button.js +2 -2
- package/esm/types/1_keyboard_button.d.ts +8 -8
- package/esm/types/1_keyboard_button.js +2 -2
- package/esm/types/1_photo.d.ts +2 -2
- package/esm/types/1_photo.js +1 -1
- package/esm/types/1_poll.d.ts +8 -8
- package/esm/types/1_poll.js +1 -1
- package/esm/types/1_sticker.d.ts +3 -3
- package/esm/types/1_sticker.js +1 -2
- package/esm/types/1_user.d.ts +4 -3
- package/esm/types/1_user.js +4 -4
- package/esm/types/1_video.d.ts +3 -3
- package/esm/types/1_video.js +1 -1
- package/esm/types/1_video_note.d.ts +2 -2
- package/esm/types/1_video_note.js +1 -1
- package/esm/types/2_game.d.ts +3 -3
- package/esm/types/2_game.js +2 -3
- package/esm/types/2_inline_keyboard_markup.d.ts +2 -2
- package/esm/types/2_inline_keyboard_markup.js +1 -1
- package/esm/types/2_inline_query.d.ts +19 -0
- package/esm/types/2_inline_query.js +41 -0
- package/esm/types/2_reply_keyboard_markup.d.ts +2 -2
- package/esm/types/2_reply_keyboard_markup.js +1 -1
- package/esm/types/3_message.d.ts +21 -23
- package/esm/types/3_message.js +16 -18
- package/esm/types/4_callback_query.d.ts +14 -0
- package/esm/types/4_callback_query.js +24 -0
- package/esm/utilities/0_base64.js +1 -1
- package/esm/utilities/0_crypto.js +1 -1
- package/esm/utilities/0_queue.js +1 -1
- package/esm/utilities/1_auth.js +1 -1
- package/package.json +1 -1
- package/script/1_utilities.d.ts +12 -0
- package/script/1_utilities.js +28 -0
- package/script/2_connection.d.ts +2 -0
- package/script/2_connection.js +18 -0
- package/script/2_tl.d.ts +10 -0
- package/script/2_tl.js +40 -0
- package/script/3_storage.d.ts +6 -0
- package/script/3_storage.js +22 -0
- package/script/3_transport.d.ts +4 -0
- package/script/3_transport.js +20 -0
- package/script/3_types.d.ts +35 -0
- package/script/3_types.js +51 -0
- package/script/{constants.d.ts → 4_constants.d.ts} +2 -2
- package/script/{constants.js → 4_constants.js} +1 -1
- package/script/5_client.d.ts +2 -0
- package/script/5_client.js +18 -0
- package/script/client/0_html.d.ts +1 -1
- package/script/client/0_html.js +2 -2
- package/script/client/0_message.d.ts +1 -2
- package/script/client/0_message.js +32 -39
- package/script/client/0_password.d.ts +2 -2
- package/script/client/0_password.js +20 -22
- package/script/client/0_utilities.d.ts +3 -5
- package/script/client/0_utilities.js +24 -68
- package/script/client/1_client_abstract.d.ts +2 -2
- package/script/client/1_client_abstract.js +6 -6
- package/script/client/2_client_plain.d.ts +3 -3
- package/script/client/2_client_plain.js +45 -52
- package/script/client/3_client.d.ts +33 -18
- package/script/client/3_client.js +291 -303
- package/script/connection/0_connection.d.ts +1 -1
- package/script/connection/1_connection_web_socket.js +5 -5
- package/script/mod.d.ts +7 -21
- package/script/mod.js +17 -45
- package/script/storage/0_storage.d.ts +4 -5
- package/script/storage/0_storage.js +11 -39
- package/script/storage/0_utilities.js +6 -6
- package/script/storage/1_storage_local_storage.d.ts +1 -1
- package/script/storage/1_storage_memory.d.ts +1 -1
- package/script/storage/1_storage_session_storage.d.ts +1 -1
- package/script/tl/0_tl_raw_reader.js +6 -6
- package/script/tl/0_tl_raw_writer.js +7 -7
- package/script/tl/1_tl_object.js +3 -3
- package/script/tl/3_deserialize.js +2 -2
- package/script/tl/3_utilities.d.ts +3 -0
- package/script/tl/3_utilities.js +48 -0
- package/script/tl/4_tl_writer.js +2 -2
- package/script/transport/0_obfuscation.d.ts +2 -2
- package/script/transport/0_obfuscation.js +5 -6
- package/script/transport/0_transport.d.ts +1 -2
- package/script/transport/1_transport_abridged.d.ts +1 -1
- package/script/transport/1_transport_abridged.js +3 -3
- package/script/transport/1_transport_intermediate.d.ts +1 -1
- package/script/transport/1_transport_intermediate.js +3 -3
- package/script/transport/2_transport_provider.d.ts +1 -1
- package/script/transport/2_transport_provider.js +2 -2
- package/script/types/!0_file_id.js +24 -27
- package/script/types/!0_misc.d.ts +7 -0
- package/script/types/!0_misc.js +2 -0
- package/script/types/0_audio.d.ts +3 -3
- package/script/types/0_audio.js +2 -25
- package/script/types/0_chat_administrator_rights.d.ts +1 -1
- package/script/types/0_chat_administrator_rights.js +2 -25
- package/script/types/0_chat_photo.d.ts +3 -3
- package/script/types/0_chat_photo.js +2 -25
- package/script/types/0_color.d.ts +2 -0
- package/script/types/{!0_id_color.js → 0_color.js} +10 -10
- package/script/types/0_contact.d.ts +2 -2
- package/script/types/0_dice.d.ts +1 -1
- package/script/types/0_force_reply.d.ts +1 -1
- package/script/types/0_force_reply.js +2 -25
- package/script/types/0_location.d.ts +1 -1
- package/script/types/0_location.js +5 -29
- package/script/types/0_mask_position.d.ts +1 -1
- package/script/types/0_message_entity.d.ts +5 -5
- package/script/types/0_message_entity.js +39 -62
- package/script/types/0_poll_option.d.ts +1 -1
- package/script/types/0_reply_keyboard_remove.d.ts +1 -1
- package/script/types/0_reply_keyboard_remove.js +4 -27
- package/script/types/0_thumbnail.d.ts +2 -2
- package/script/types/0_thumbnail.js +2 -25
- package/script/types/0_venue.d.ts +1 -1
- package/script/types/0_venue.js +2 -26
- package/script/types/0_voice.d.ts +3 -3
- package/script/types/0_web_app_info.d.ts +2 -2
- package/script/types/1_animation.d.ts +3 -3
- package/script/types/1_animation.js +2 -25
- package/script/types/1_chat.d.ts +5 -4
- package/script/types/1_chat.js +20 -44
- package/script/types/1_document.d.ts +4 -4
- package/script/types/1_document.js +2 -25
- package/script/types/1_inline_keyboard_button.d.ts +4 -4
- package/script/types/1_inline_keyboard_button.js +19 -42
- package/script/types/1_keyboard_button.d.ts +8 -8
- package/script/types/1_keyboard_button.js +24 -47
- package/script/types/1_photo.d.ts +2 -2
- package/script/types/1_photo.js +4 -27
- package/script/types/1_poll.d.ts +8 -8
- package/script/types/1_poll.js +2 -2
- package/script/types/1_sticker.d.ts +3 -3
- package/script/types/1_sticker.js +6 -30
- package/script/types/1_user.d.ts +4 -3
- package/script/types/1_user.js +6 -29
- package/script/types/1_video.d.ts +3 -3
- package/script/types/1_video.js +2 -25
- package/script/types/1_video_note.d.ts +2 -2
- package/script/types/1_video_note.js +2 -25
- package/script/types/2_game.d.ts +3 -3
- package/script/types/2_game.js +6 -30
- package/script/types/2_inline_keyboard_markup.d.ts +2 -2
- package/script/types/2_inline_keyboard_markup.js +3 -26
- package/script/types/2_inline_query.d.ts +19 -0
- package/script/types/2_inline_query.js +45 -0
- package/script/types/2_reply_keyboard_markup.d.ts +2 -2
- package/script/types/2_reply_keyboard_markup.js +3 -26
- package/script/types/3_message.d.ts +21 -23
- package/script/types/3_message.js +94 -119
- package/script/types/4_callback_query.d.ts +14 -0
- package/script/types/4_callback_query.js +28 -0
- package/script/utilities/0_base64.js +3 -3
- package/script/utilities/0_crypto.js +3 -3
- package/script/utilities/0_queue.js +2 -2
- package/script/utilities/1_auth.js +5 -5
- package/esm/types/!0_id_color.d.ts +0 -1
- package/esm/types/!0_id_color.js +0 -16
- package/script/types/!0_id_color.d.ts +0 -1
- /package/esm/{deps.d.ts → 0_deps.d.ts} +0 -0
- /package/esm/{deps.js → 0_deps.js} +0 -0
- /package/script/{deps.d.ts → 0_deps.d.ts} +0 -0
- /package/script/{deps.js → 0_deps.js} +0 -0
|
@@ -1,86 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.messageEntityToTlObject = exports.constructMessageEntity = void 0;
|
|
27
|
-
const
|
|
4
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
28
5
|
function constructMessageEntity(obj) {
|
|
29
|
-
if (obj instanceof types.MessageEntityMention) {
|
|
6
|
+
if (obj instanceof _2_tl_js_1.types.MessageEntityMention) {
|
|
30
7
|
return { type: "mention", offset: obj.offset, length: obj.length };
|
|
31
8
|
}
|
|
32
|
-
else if (obj instanceof types.MessageEntityHashtag) {
|
|
9
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityHashtag) {
|
|
33
10
|
return { type: "hashtag", offset: obj.offset, length: obj.length };
|
|
34
11
|
}
|
|
35
|
-
else if (obj instanceof types.MessageEntityBotCommand) {
|
|
12
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityBotCommand) {
|
|
36
13
|
return { type: "bot_command", offset: obj.offset ?? 0, length: obj.length };
|
|
37
14
|
}
|
|
38
|
-
else if (obj instanceof types.MessageEntityURL) {
|
|
15
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityURL) {
|
|
39
16
|
return { type: "url", offset: obj.offset, length: obj.length };
|
|
40
17
|
}
|
|
41
|
-
else if (obj instanceof types.MessageEntityEmail) {
|
|
18
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityEmail) {
|
|
42
19
|
return { type: "email", offset: obj.offset, length: obj.length };
|
|
43
20
|
}
|
|
44
|
-
else if (obj instanceof types.MessageEntityBold) {
|
|
21
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityBold) {
|
|
45
22
|
return { type: "bold", offset: obj.offset, length: obj.length };
|
|
46
23
|
}
|
|
47
|
-
else if (obj instanceof types.MessageEntityItalic) {
|
|
24
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityItalic) {
|
|
48
25
|
return { type: "italic", offset: obj.offset, length: obj.length };
|
|
49
26
|
}
|
|
50
|
-
else if (obj instanceof types.MessageEntityCode) {
|
|
27
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityCode) {
|
|
51
28
|
return { type: "code", offset: obj.offset, length: obj.length };
|
|
52
29
|
}
|
|
53
|
-
else if (obj instanceof types.MessageEntityPre) {
|
|
30
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityPre) {
|
|
54
31
|
return { type: "pre", offset: obj.offset, length: obj.length, language: obj.language };
|
|
55
32
|
}
|
|
56
|
-
else if (obj instanceof types.MessageEntityTextURL) {
|
|
33
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityTextURL) {
|
|
57
34
|
return { type: "text_link", offset: obj.offset, length: obj.length, url: obj.url };
|
|
58
35
|
}
|
|
59
|
-
else if (obj instanceof types.MessageEntityMentionName) {
|
|
36
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityMentionName) {
|
|
60
37
|
return { type: "text_mention", offset: obj.offset, length: obj.length, userId: Number(obj.userId) };
|
|
61
38
|
}
|
|
62
|
-
else if (obj instanceof types.MessageEntityCashtag) {
|
|
39
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityCashtag) {
|
|
63
40
|
return { type: "cashtag", offset: obj.offset, length: obj.length };
|
|
64
41
|
}
|
|
65
|
-
else if (obj instanceof types.MessageEntityPhone) {
|
|
42
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityPhone) {
|
|
66
43
|
return { type: "phone_number", offset: obj.offset, length: obj.length };
|
|
67
44
|
}
|
|
68
|
-
else if (obj instanceof types.MessageEntityUnderline) {
|
|
45
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityUnderline) {
|
|
69
46
|
return { type: "underline", offset: obj.offset, length: obj.length };
|
|
70
47
|
}
|
|
71
|
-
else if (obj instanceof types.MessageEntityStrike) {
|
|
48
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityStrike) {
|
|
72
49
|
return { type: "strikethrough", offset: obj.offset, length: obj.length };
|
|
73
50
|
}
|
|
74
|
-
else if (obj instanceof types.MessageEntityBlockquote) {
|
|
51
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityBlockquote) {
|
|
75
52
|
return { type: "blockquote", offset: obj.offset, length: obj.length };
|
|
76
53
|
}
|
|
77
|
-
else if (obj instanceof types.MessageEntityBankCard) {
|
|
54
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityBankCard) {
|
|
78
55
|
return { type: "bank_card", offset: obj.offset, length: obj.length };
|
|
79
56
|
}
|
|
80
|
-
else if (obj instanceof types.MessageEntitySpoiler) {
|
|
57
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntitySpoiler) {
|
|
81
58
|
return { type: "spoiler", offset: obj.offset, length: obj.length };
|
|
82
59
|
}
|
|
83
|
-
else if (obj instanceof types.MessageEntityCustomEmoji) {
|
|
60
|
+
else if (obj instanceof _2_tl_js_1.types.MessageEntityCustomEmoji) {
|
|
84
61
|
return { type: "custom_emoji", offset: obj.offset, length: obj.length, customEmojiId: String(obj.documentId) };
|
|
85
62
|
}
|
|
86
63
|
else {
|
|
@@ -92,43 +69,43 @@ function messageEntityToTlObject(entity) {
|
|
|
92
69
|
const { offset, length } = entity;
|
|
93
70
|
switch (entity.type) {
|
|
94
71
|
case "mention":
|
|
95
|
-
return new types.MessageEntityMention({ offset, length });
|
|
72
|
+
return new _2_tl_js_1.types.MessageEntityMention({ offset, length });
|
|
96
73
|
case "hashtag":
|
|
97
|
-
return new types.MessageEntityHashtag({ offset, length });
|
|
74
|
+
return new _2_tl_js_1.types.MessageEntityHashtag({ offset, length });
|
|
98
75
|
case "bot_command":
|
|
99
|
-
return new types.MessageEntityBotCommand({ offset, length });
|
|
76
|
+
return new _2_tl_js_1.types.MessageEntityBotCommand({ offset, length });
|
|
100
77
|
case "url":
|
|
101
|
-
return new types.MessageEntityURL({ offset, length });
|
|
78
|
+
return new _2_tl_js_1.types.MessageEntityURL({ offset, length });
|
|
102
79
|
case "email":
|
|
103
|
-
return new types.MessageEntityEmail({ offset, length });
|
|
80
|
+
return new _2_tl_js_1.types.MessageEntityEmail({ offset, length });
|
|
104
81
|
case "bold":
|
|
105
|
-
return new types.MessageEntityBold({ offset, length });
|
|
82
|
+
return new _2_tl_js_1.types.MessageEntityBold({ offset, length });
|
|
106
83
|
case "italic":
|
|
107
|
-
return new types.MessageEntityItalic({ offset, length });
|
|
84
|
+
return new _2_tl_js_1.types.MessageEntityItalic({ offset, length });
|
|
108
85
|
case "code":
|
|
109
|
-
return new types.MessageEntityCode({ offset, length });
|
|
86
|
+
return new _2_tl_js_1.types.MessageEntityCode({ offset, length });
|
|
110
87
|
case "pre":
|
|
111
|
-
return new types.MessageEntityPre({ offset, length, language: entity.language });
|
|
88
|
+
return new _2_tl_js_1.types.MessageEntityPre({ offset, length, language: entity.language });
|
|
112
89
|
case "text_link":
|
|
113
|
-
return new types.MessageEntityTextURL({ offset, length, url: entity.url });
|
|
90
|
+
return new _2_tl_js_1.types.MessageEntityTextURL({ offset, length, url: entity.url });
|
|
114
91
|
case "text_mention":
|
|
115
|
-
return new types.MessageEntityMentionName({ offset, length, userId: BigInt(entity.userId) });
|
|
92
|
+
return new _2_tl_js_1.types.MessageEntityMentionName({ offset, length, userId: BigInt(entity.userId) });
|
|
116
93
|
case "cashtag":
|
|
117
|
-
return new types.MessageEntityCashtag({ offset, length });
|
|
94
|
+
return new _2_tl_js_1.types.MessageEntityCashtag({ offset, length });
|
|
118
95
|
case "phone_number":
|
|
119
|
-
return new types.MessageEntityPhone({ offset, length });
|
|
96
|
+
return new _2_tl_js_1.types.MessageEntityPhone({ offset, length });
|
|
120
97
|
case "underline":
|
|
121
|
-
return new types.MessageEntityUnderline({ offset, length });
|
|
98
|
+
return new _2_tl_js_1.types.MessageEntityUnderline({ offset, length });
|
|
122
99
|
case "strikethrough":
|
|
123
|
-
return new types.MessageEntityStrike({ offset, length });
|
|
100
|
+
return new _2_tl_js_1.types.MessageEntityStrike({ offset, length });
|
|
124
101
|
case "blockquote":
|
|
125
|
-
return new types.MessageEntityBlockquote({ offset, length });
|
|
102
|
+
return new _2_tl_js_1.types.MessageEntityBlockquote({ offset, length });
|
|
126
103
|
case "bank_card":
|
|
127
|
-
return new types.MessageEntityBankCard({ offset, length });
|
|
104
|
+
return new _2_tl_js_1.types.MessageEntityBankCard({ offset, length });
|
|
128
105
|
case "spoiler":
|
|
129
|
-
return new types.MessageEntitySpoiler({ offset, length });
|
|
106
|
+
return new _2_tl_js_1.types.MessageEntitySpoiler({ offset, length });
|
|
130
107
|
case "custom_emoji":
|
|
131
|
-
return new types.MessageEntityCustomEmoji({ offset, length, documentId: BigInt(entity.customEmojiId) });
|
|
108
|
+
return new _2_tl_js_1.types.MessageEntityCustomEmoji({ offset, length, documentId: BigInt(entity.customEmojiId) });
|
|
132
109
|
}
|
|
133
110
|
}
|
|
134
111
|
exports.messageEntityToTlObject = messageEntityToTlObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
2
|
/** Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button. */
|
|
3
3
|
export interface ReplyKeyboardRemove {
|
|
4
4
|
/** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use _one_time_keyboard_ in `ReplyKeyboardMarkup`) */
|
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.replyKeyboardRemoveToTlObject = exports.constructReplyKeyboardRemove = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
29
6
|
function constructReplyKeyboardRemove(replyMarkup_) {
|
|
30
|
-
return (0,
|
|
7
|
+
return (0, _1_utilities_js_1.cleanObject)({ removeKeyboard: true, selective: replyMarkup_.selective });
|
|
31
8
|
}
|
|
32
9
|
exports.constructReplyKeyboardRemove = constructReplyKeyboardRemove;
|
|
33
10
|
function replyKeyboardRemoveToTlObject(replyMarkup) {
|
|
34
|
-
return new types.ReplyKeyboardHide({ selective: replyMarkup.selective || undefined });
|
|
11
|
+
return new _2_tl_js_1.types.ReplyKeyboardHide({ selective: replyMarkup.selective || undefined });
|
|
35
12
|
}
|
|
36
13
|
exports.replyKeyboardRemoveToTlObject = replyKeyboardRemoveToTlObject;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
2
|
/** This object represents thumbnail of a file or a sticker. */
|
|
3
3
|
export interface Thumbnail {
|
|
4
4
|
/** Identifier for this file, which can be used to download or reuse the file */
|
|
5
5
|
fileId: string;
|
|
6
|
-
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
|
6
|
+
/** Unique identifier for this file, which is supposed to be the same over time and for different users and bots. Can't be used to download or reuse the file. */
|
|
7
7
|
fileUniqueId: string;
|
|
8
8
|
/** Photo width */
|
|
9
9
|
width: number;
|
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.constructThumbnail = void 0;
|
|
27
|
-
const
|
|
4
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
28
5
|
const _0_file_id_js_1 = require("./!0_file_id.js");
|
|
29
6
|
function constructThumbnail(size, file) {
|
|
30
|
-
const fileType = file instanceof types.Photo ? _0_file_id_js_1.FileType.Photo : _0_file_id_js_1.FileType.Document;
|
|
7
|
+
const fileType = file instanceof _2_tl_js_1.types.Photo ? _0_file_id_js_1.FileType.Photo : _0_file_id_js_1.FileType.Document;
|
|
31
8
|
const fileId = new _0_file_id_js_1.FileID(null, null, fileType, file.dcId, {
|
|
32
9
|
mediaId: file.id,
|
|
33
10
|
accessHash: file.accessHash,
|
package/script/types/0_venue.js
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.constructVenue = void 0;
|
|
27
|
-
const
|
|
28
|
-
const types = __importStar(require("../tl/2_types.js"));
|
|
4
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
29
5
|
function constructVenue(media_) {
|
|
30
|
-
const geo = media_.geo[
|
|
6
|
+
const geo = media_.geo[_2_tl_js_1.as](_2_tl_js_1.types.GeoPoint);
|
|
31
7
|
return {
|
|
32
8
|
location: {
|
|
33
9
|
latitude: geo.lat,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
2
|
/** This object represents a voice note. */
|
|
3
3
|
export interface Voice {
|
|
4
4
|
/** Identifier for this file, which can be used to download or reuse the file */
|
|
5
5
|
fileId: string;
|
|
6
|
-
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
|
6
|
+
/** Unique identifier for this file, which is supposed to be the same over time and for different users and bots. Can't be used to download or reuse the file. */
|
|
7
7
|
fileUniqueId: string;
|
|
8
8
|
/** Duration of the audio in seconds as defined by sender */
|
|
9
9
|
duration: number;
|
|
10
10
|
/** MIME type of the file as defined by sender */
|
|
11
11
|
mimeType: string;
|
|
12
|
-
/** File size in bytes
|
|
12
|
+
/** File size in bytes */
|
|
13
13
|
fileSize: number;
|
|
14
14
|
}
|
|
15
15
|
export declare function constructVoice(document: types.Document, audioAttributes: types.DocumentAttributeAudio, fileId: string, fileUniqueId: string): Voice;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** Describes a
|
|
1
|
+
/** Describes a Web App */
|
|
2
2
|
export interface WebAppInfo {
|
|
3
|
-
/** An HTTPS URL of a Web App to be opened with additional data
|
|
3
|
+
/** An HTTPS URL of a Web App to be opened with additional data */
|
|
4
4
|
url: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function constructWebAppInfo(url: string): WebAppInfo;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
2
|
import { Thumbnail } from "./0_thumbnail.js";
|
|
3
3
|
/** This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). */
|
|
4
4
|
export interface Animation {
|
|
5
5
|
/** Identifier for this file, which can be used to download or reuse the file */
|
|
6
6
|
fileId: string;
|
|
7
|
-
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
|
7
|
+
/** Unique identifier for this file, which is supposed to be the same over time and for different users and bots. Can't be used to download or reuse the file. */
|
|
8
8
|
fileUniqueId: string;
|
|
9
9
|
/** Video width as defined by sender */
|
|
10
10
|
width: number;
|
|
@@ -18,7 +18,7 @@ export interface Animation {
|
|
|
18
18
|
fileName?: string;
|
|
19
19
|
/** MIME type of the file as defined by sender */
|
|
20
20
|
mimeType: string;
|
|
21
|
-
/** File size in bytes
|
|
21
|
+
/** File size in bytes */
|
|
22
22
|
fileSize: number;
|
|
23
23
|
}
|
|
24
24
|
export declare function constructAnimation(document: types.Document, videoAttribute: types.DocumentAttributeVideo | undefined, fileAttribute: types.DocumentAttributeFilename | undefined, fileId: string, fileUniqueId: string): Animation;
|
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.constructAnimation = void 0;
|
|
27
|
-
const
|
|
4
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
28
5
|
const _0_thumbnail_js_1 = require("./0_thumbnail.js");
|
|
29
6
|
function constructAnimation(document, videoAttribute, fileAttribute, fileId, fileUniqueId) {
|
|
30
7
|
return {
|
|
@@ -33,7 +10,7 @@ function constructAnimation(document, videoAttribute, fileAttribute, fileId, fil
|
|
|
33
10
|
width: videoAttribute?.w ?? 0,
|
|
34
11
|
height: videoAttribute?.h ?? 0,
|
|
35
12
|
duration: videoAttribute?.duration ?? 0,
|
|
36
|
-
thumbnails: document.thumbs ? document.thumbs.map((v) => v instanceof types.PhotoSize ? (0, _0_thumbnail_js_1.constructThumbnail)(v, document) : null).filter((v) => v) : [],
|
|
13
|
+
thumbnails: document.thumbs ? document.thumbs.map((v) => v instanceof _2_tl_js_1.types.PhotoSize ? (0, _0_thumbnail_js_1.constructThumbnail)(v, document) : null).filter((v) => v) : [],
|
|
37
14
|
fileName: fileAttribute?.fileName,
|
|
38
15
|
mimeType: document.mimeType,
|
|
39
16
|
fileSize: Number(document.size),
|
package/script/types/1_chat.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
|
+
import { Color } from "./0_color.js";
|
|
2
3
|
import { ChatPhoto } from "./0_chat_photo.js";
|
|
3
4
|
export declare enum ChatType {
|
|
4
5
|
Private = "private",
|
|
@@ -8,11 +9,11 @@ export declare enum ChatType {
|
|
|
8
9
|
}
|
|
9
10
|
export declare namespace Chat {
|
|
10
11
|
interface Base {
|
|
11
|
-
/** Type of chat, can be either
|
|
12
|
+
/** Type of chat, can be either "private", "group", "supergroup" or "channel" */
|
|
12
13
|
type: ChatType;
|
|
13
|
-
/** Unique identifier for this chat
|
|
14
|
+
/** Unique identifier for this chat */
|
|
14
15
|
id: number;
|
|
15
|
-
|
|
16
|
+
color: Color;
|
|
16
17
|
/** Chat photo. */
|
|
17
18
|
photo?: ChatPhoto;
|
|
18
19
|
}
|
package/script/types/1_chat.js
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.constructChat = exports.ChatType = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const _0_id_color_js_1 = require("./!0_id_color.js");
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _4_constants_js_1 = require("../4_constants.js");
|
|
7
|
+
const _0_color_js_1 = require("./0_color.js");
|
|
32
8
|
const _0_chat_photo_js_1 = require("./0_chat_photo.js");
|
|
33
9
|
var ChatType;
|
|
34
10
|
(function (ChatType) {
|
|
@@ -38,13 +14,13 @@ var ChatType;
|
|
|
38
14
|
ChatType["Channel"] = "channel";
|
|
39
15
|
})(ChatType = exports.ChatType || (exports.ChatType = {}));
|
|
40
16
|
function constructChat(chat) {
|
|
41
|
-
if (chat instanceof types.User) {
|
|
17
|
+
if (chat instanceof _2_tl_js_1.types.User) {
|
|
42
18
|
const id = Number(chat.id);
|
|
43
19
|
const chat_ = {
|
|
44
20
|
type: ChatType.Private,
|
|
45
21
|
isBot: chat.bot || false,
|
|
46
22
|
id,
|
|
47
|
-
|
|
23
|
+
color: (0, _0_color_js_1.getColor)(id),
|
|
48
24
|
firstName: chat.firstName || "",
|
|
49
25
|
lastName: chat.lastName,
|
|
50
26
|
isScam: chat.scam || false,
|
|
@@ -56,33 +32,33 @@ function constructChat(chat) {
|
|
|
56
32
|
chat_.isRestricted = chat.restricted || false;
|
|
57
33
|
chat_.restrictionReason = chat.restrictionReason;
|
|
58
34
|
}
|
|
59
|
-
if (chat.photo instanceof types.UserProfilePhoto) {
|
|
35
|
+
if (chat.photo instanceof _2_tl_js_1.types.UserProfilePhoto) {
|
|
60
36
|
chat_.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(chat.photo, chat_.id, chat.accessHash ?? 0n);
|
|
61
37
|
}
|
|
62
|
-
return (0,
|
|
38
|
+
return (0, _1_utilities_js_1.cleanObject)(chat_);
|
|
63
39
|
}
|
|
64
|
-
else if (chat instanceof types.Chat) {
|
|
40
|
+
else if (chat instanceof _2_tl_js_1.types.Chat) {
|
|
65
41
|
const id = Number(-chat.id);
|
|
66
42
|
const chat_ = {
|
|
67
43
|
type: ChatType.Group,
|
|
68
44
|
id,
|
|
69
|
-
|
|
45
|
+
color: (0, _0_color_js_1.getColor)(id),
|
|
70
46
|
title: chat.title,
|
|
71
47
|
isCreator: chat.creator || false,
|
|
72
48
|
};
|
|
73
|
-
if (chat.photo instanceof types.ChatPhoto) {
|
|
49
|
+
if (chat.photo instanceof _2_tl_js_1.types.ChatPhoto) {
|
|
74
50
|
chat_.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(chat.photo, chat_.id, 0n);
|
|
75
51
|
}
|
|
76
|
-
return (0,
|
|
52
|
+
return (0, _1_utilities_js_1.cleanObject)(chat_);
|
|
77
53
|
}
|
|
78
|
-
else if (chat instanceof types.Channel) {
|
|
54
|
+
else if (chat instanceof _2_tl_js_1.types.Channel) {
|
|
79
55
|
let chat_;
|
|
80
56
|
const { title, scam: isScam = false, fake: isFake = false, verified: isVerified = false, restricted: isRestricted = false, } = chat;
|
|
81
|
-
const id =
|
|
57
|
+
const id = _4_constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id);
|
|
82
58
|
if (chat.megagroup) {
|
|
83
59
|
chat_ = {
|
|
84
60
|
id,
|
|
85
|
-
|
|
61
|
+
color: (0, _0_color_js_1.getColor)(id),
|
|
86
62
|
type: ChatType.Supergroup,
|
|
87
63
|
title,
|
|
88
64
|
isScam,
|
|
@@ -93,10 +69,10 @@ function constructChat(chat) {
|
|
|
93
69
|
};
|
|
94
70
|
}
|
|
95
71
|
else {
|
|
96
|
-
const id =
|
|
72
|
+
const id = _4_constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id);
|
|
97
73
|
chat_ = {
|
|
98
74
|
id,
|
|
99
|
-
|
|
75
|
+
color: (0, _0_color_js_1.getColor)(id),
|
|
100
76
|
type: ChatType.Channel,
|
|
101
77
|
title,
|
|
102
78
|
isScam,
|
|
@@ -110,13 +86,13 @@ function constructChat(chat) {
|
|
|
110
86
|
if (chat_.isRestricted) {
|
|
111
87
|
chat_.restrictionReason = chat.restrictionReason;
|
|
112
88
|
}
|
|
113
|
-
if (chat.photo instanceof types.ChatPhoto) {
|
|
89
|
+
if (chat.photo instanceof _2_tl_js_1.types.ChatPhoto) {
|
|
114
90
|
chat_.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(chat.photo, chat_.id, chat.accessHash ?? 0n);
|
|
115
91
|
}
|
|
116
|
-
return (0,
|
|
92
|
+
return (0, _1_utilities_js_1.cleanObject)(chat_);
|
|
117
93
|
}
|
|
118
94
|
else {
|
|
119
|
-
(0,
|
|
95
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
98
|
exports.constructChat = constructChat;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
2
|
import { Thumbnail } from "./0_thumbnail.js";
|
|
3
|
-
/** This object represents a general file (as opposed to
|
|
3
|
+
/** This object represents a general file (as opposed to photos, voice messages and audio files). */
|
|
4
4
|
export interface Document {
|
|
5
5
|
/** Identifier for this file, which can be used to download or reuse the file */
|
|
6
6
|
fileId: string;
|
|
7
|
-
/** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
|
|
7
|
+
/** Unique identifier for this file, which is supposed to be the same over time and for different users and bots. Can't be used to download or reuse the file. */
|
|
8
8
|
fileUniqueId: string;
|
|
9
9
|
/** Document thumbnail as defined by sender */
|
|
10
10
|
thumbnails: Thumbnail[];
|
|
@@ -12,7 +12,7 @@ export interface Document {
|
|
|
12
12
|
fileName: string;
|
|
13
13
|
/** MIME type of the file as defined by sender */
|
|
14
14
|
mimeType: string;
|
|
15
|
-
/** File size in bytes
|
|
15
|
+
/** File size in bytes */
|
|
16
16
|
fileSize: number;
|
|
17
17
|
}
|
|
18
18
|
export declare function constructDocument(document: types.Document, fileNameAttribute: types.DocumentAttributeFilename, fileId: string, fileUniqueId: string): Document;
|
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.constructDocument = void 0;
|
|
27
|
-
const
|
|
4
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
28
5
|
const _0_thumbnail_js_1 = require("./0_thumbnail.js");
|
|
29
6
|
function constructDocument(document, fileNameAttribute, fileId, fileUniqueId) {
|
|
30
7
|
return {
|
|
31
8
|
fileId,
|
|
32
9
|
fileUniqueId,
|
|
33
|
-
thumbnails: document.thumbs ? document.thumbs.map((v) => v instanceof types.PhotoSize ? (0, _0_thumbnail_js_1.constructThumbnail)(v, document) : null).filter((v) => v) : [],
|
|
10
|
+
thumbnails: document.thumbs ? document.thumbs.map((v) => v instanceof _2_tl_js_1.types.PhotoSize ? (0, _0_thumbnail_js_1.constructThumbnail)(v, document) : null).filter((v) => v) : [],
|
|
34
11
|
fileName: fileNameAttribute.fileName,
|
|
35
12
|
mimeType: document.mimeType,
|
|
36
13
|
fileSize: Number(document.size),
|