@mtkruto/node 0.1.190 → 0.1.200
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_errors.d.ts +12 -0
- package/esm/0_errors.js +19 -0
- package/esm/1_utilities.d.ts +1 -1
- package/esm/1_utilities.js +1 -1
- package/esm/2_tl.d.ts +6 -6
- package/esm/2_tl.js +6 -6
- package/esm/3_storage.d.ts +5 -5
- package/esm/3_storage.js +5 -5
- package/esm/3_types.d.ts +6 -5
- package/esm/3_types.js +6 -5
- package/esm/4_constants.d.ts +2 -2
- package/esm/4_constants.js +2 -2
- package/esm/5_client.d.ts +1 -1
- package/esm/5_client.js +1 -1
- package/esm/client/0_client_abstract.js +3 -2
- package/esm/client/0_html.js +4 -3
- package/esm/client/0_markdown.js +6 -5
- package/esm/client/0_params.d.ts +7 -1
- package/esm/client/0_types.d.ts +1 -2
- package/esm/client/0_types.js +1 -2
- package/esm/client/0_utilities.d.ts +0 -3
- package/esm/client/0_utilities.js +2 -21
- package/esm/client/1_business_connection_manager.d.ts +11 -0
- package/esm/client/1_business_connection_manager.js +47 -0
- package/esm/client/1_client_encrypted.js +1 -1
- package/esm/client/1_client_plain.js +3 -4
- package/esm/client/1_composer.js +3 -2
- package/esm/client/1_file_manager.js +4 -4
- package/esm/client/1_update_manager.d.ts +8 -1
- package/esm/client/1_update_manager.js +88 -8
- package/esm/client/2_message_manager.d.ts +7 -6
- package/esm/client/2_message_manager.js +89 -74
- package/esm/client/3_chat_list_manager.js +3 -2
- package/esm/client/3_story_manager.js +2 -1
- package/esm/client/4_client.d.ts +422 -421
- package/esm/client/4_client.js +578 -520
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/storage/0_storage.d.ts +5 -0
- package/esm/storage/0_storage.js +20 -0
- package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
- package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
- package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
- package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
- package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
- package/esm/tl/2_types.d.ts +1071 -183
- package/esm/tl/2_types.js +2916 -464
- package/esm/tl/3_functions.d.ts +381 -17
- package/esm/tl/3_functions.js +1002 -120
- package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
- package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
- package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
- package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
- package/esm/tl/{6_message.js → 7_message.js} +3 -3
- package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
- package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
- package/esm/types/0_chat_photo.d.ts +1 -0
- package/esm/types/0_chat_photo.js +8 -5
- package/esm/types/0_message_entity.d.ts +1 -1
- package/esm/types/0_thumbnail.js +1 -1
- package/esm/types/1_bot_command_scope.d.ts +1 -1
- package/esm/types/1_photo.js +2 -2
- package/esm/types/1_story_privacy.d.ts +1 -1
- package/esm/types/2_business_connection.d.ts +11 -0
- package/esm/types/2_business_connection.js +12 -0
- package/esm/types/2_chat_member.d.ts +1 -1
- package/esm/types/2_chosen_inline_result.d.ts +1 -1
- package/esm/types/2_game.js +1 -1
- package/esm/types/2_inline_keyboard_button.d.ts +1 -1
- package/esm/types/2_inline_query.d.ts +1 -1
- package/esm/types/2_invite_link.d.ts +1 -1
- package/esm/types/2_message_reaction_count.d.ts +1 -1
- package/esm/types/2_message_reactions.d.ts +1 -1
- package/esm/types/2_story_content.js +1 -1
- package/{script/types/1_story_interactive_area.d.ts → esm/types/2_story_interactive_area.d.ts} +2 -2
- package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
- package/esm/types/3_chat_member_updated.d.ts +1 -1
- package/esm/types/3_reply_markup.d.ts +1 -1
- package/esm/types/3_story.d.ts +2 -2
- package/esm/types/3_story.js +1 -1
- package/esm/types/4_inline_query_result.d.ts +1 -1
- package/esm/types/4_inline_query_result.js +1 -1
- package/esm/types/4_message.d.ts +9 -3
- package/esm/types/4_message.js +22 -5
- package/esm/types/5_callback_query.d.ts +1 -1
- package/esm/types/5_callback_query.js +2 -1
- package/esm/types/5_chat.d.ts +1 -1
- package/esm/types/6_update.d.ts +12 -2
- package/esm/types/{0__file_id.js → _file_id.js} +2 -1
- package/package.json +1 -1
- package/script/0_errors.d.ts +12 -0
- package/script/0_errors.js +27 -0
- package/script/1_utilities.d.ts +1 -1
- package/script/1_utilities.js +1 -1
- package/script/2_tl.d.ts +6 -6
- package/script/2_tl.js +6 -6
- package/script/3_storage.d.ts +5 -5
- package/script/3_storage.js +5 -5
- package/script/3_types.d.ts +6 -5
- package/script/3_types.js +6 -5
- package/script/4_constants.d.ts +2 -2
- package/script/4_constants.js +2 -2
- package/script/5_client.d.ts +1 -1
- package/script/5_client.js +1 -1
- package/script/client/0_client_abstract.js +3 -2
- package/script/client/0_html.js +4 -3
- package/script/client/0_markdown.js +6 -5
- package/script/client/0_params.d.ts +7 -1
- package/script/client/0_types.d.ts +1 -2
- package/script/client/0_types.js +0 -4
- package/script/client/0_utilities.d.ts +0 -3
- package/script/client/0_utilities.js +3 -24
- package/script/client/1_business_connection_manager.d.ts +11 -0
- package/script/client/1_business_connection_manager.js +51 -0
- package/script/client/1_client_encrypted.js +2 -2
- package/script/client/1_client_plain.js +3 -4
- package/script/client/1_composer.js +3 -2
- package/script/client/1_file_manager.js +5 -5
- package/script/client/1_update_manager.d.ts +8 -1
- package/script/client/1_update_manager.js +88 -8
- package/script/client/2_message_manager.d.ts +7 -6
- package/script/client/2_message_manager.js +88 -73
- package/script/client/3_chat_list_manager.js +3 -2
- package/script/client/3_story_manager.js +2 -1
- package/script/client/4_client.d.ts +422 -421
- package/script/client/4_client.js +578 -520
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/storage/0_storage.d.ts +5 -0
- package/script/storage/0_storage.js +20 -0
- package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
- package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
- package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
- package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
- package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
- package/script/tl/2_types.d.ts +1071 -183
- package/script/tl/2_types.js +3028 -504
- package/script/tl/3_functions.d.ts +381 -17
- package/script/tl/3_functions.js +1047 -143
- package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
- package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
- package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
- package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
- package/script/tl/{6_message.js → 7_message.js} +8 -8
- package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
- package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
- package/script/types/0_chat_photo.d.ts +1 -0
- package/script/types/0_chat_photo.js +16 -13
- package/script/types/0_message_entity.d.ts +1 -1
- package/script/types/0_thumbnail.js +6 -6
- package/script/types/1_bot_command_scope.d.ts +1 -1
- package/script/types/1_photo.js +7 -7
- package/script/types/1_story_privacy.d.ts +1 -1
- package/script/types/2_business_connection.d.ts +11 -0
- package/script/types/2_business_connection.js +16 -0
- package/script/types/2_chat_member.d.ts +1 -1
- package/script/types/2_chosen_inline_result.d.ts +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_inline_keyboard_button.d.ts +1 -1
- package/script/types/2_inline_query.d.ts +1 -1
- package/script/types/2_invite_link.d.ts +1 -1
- package/script/types/2_message_reaction_count.d.ts +1 -1
- package/script/types/2_message_reactions.d.ts +1 -1
- package/script/types/2_story_content.js +4 -4
- package/{esm/types/1_story_interactive_area.d.ts → script/types/2_story_interactive_area.d.ts} +2 -2
- package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
- package/script/types/3_chat_member_updated.d.ts +1 -1
- package/script/types/3_reply_markup.d.ts +1 -1
- package/script/types/3_story.d.ts +2 -2
- package/script/types/3_story.js +2 -2
- package/script/types/4_inline_query_result.d.ts +1 -1
- package/script/types/4_inline_query_result.js +2 -2
- package/script/types/4_message.d.ts +9 -3
- package/script/types/4_message.js +37 -20
- package/script/types/5_callback_query.d.ts +1 -1
- package/script/types/5_callback_query.js +2 -1
- package/script/types/5_chat.d.ts +1 -1
- package/script/types/6_update.d.ts +12 -2
- package/script/types/{0__file_id.js → _file_id.js} +2 -1
- /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
- /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
- /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
- /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
- /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
- /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
- /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
- /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
- /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
- /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
- /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
- /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
- /package/esm/types/{1__getters.js → _getters.js} +0 -0
- /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
- /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
- /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
- /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
- /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
- /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
- /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
- /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
- /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
- /package/script/types/{0_venue.js → 1_venue.js} +0 -0
- /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
- /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
- /package/script/types/{1__getters.js → _getters.js} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RPCResult = void 0;
|
|
4
4
|
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
5
|
-
const
|
|
5
|
+
const _4_tl_reader_js_1 = require("./4_tl_reader.js");
|
|
6
6
|
class RPCResult {
|
|
7
7
|
static get [_1_tl_object_js_1.id]() {
|
|
8
8
|
return 0xF35C6D01;
|
|
@@ -25,7 +25,7 @@ class RPCResult {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
static deserialize(buffer) {
|
|
28
|
-
const reader = new
|
|
28
|
+
const reader = new _4_tl_reader_js_1.TLReader(buffer);
|
|
29
29
|
const messageId = reader.readInt64();
|
|
30
30
|
const result = reader.readObject();
|
|
31
31
|
return new RPCResult(messageId, result);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { serialize } from "./1_tl_object.js";
|
|
2
|
-
import { ReadObject, TLReader } from "./
|
|
3
|
-
import { RPCResult } from "./
|
|
2
|
+
import { ReadObject, TLReader } from "./4_tl_reader.js";
|
|
3
|
+
import { RPCResult } from "./6_rpc_result.js";
|
|
4
4
|
export declare function calculateLength(object: Message_ | ReadObject): number;
|
|
5
5
|
export declare class Message_ {
|
|
6
6
|
readonly id: bigint;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Message_ = exports.calculateLength = void 0;
|
|
4
4
|
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const _4_tl_reader_js_1 = require("./4_tl_reader.js");
|
|
6
|
+
const _5_tl_writer_js_1 = require("./5_tl_writer.js");
|
|
7
|
+
const _6_rpc_result_js_1 = require("./6_rpc_result.js");
|
|
8
8
|
function calculateLength(object) {
|
|
9
9
|
let length = 0;
|
|
10
10
|
if (Array.isArray(object)) {
|
|
@@ -45,10 +45,10 @@ class Message_ {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
[_1_tl_object_js_1.serialize]() {
|
|
48
|
-
if (this.body instanceof
|
|
48
|
+
if (this.body instanceof _6_rpc_result_js_1.RPCResult) {
|
|
49
49
|
throw new Error("Not applicable");
|
|
50
50
|
}
|
|
51
|
-
return new
|
|
51
|
+
return new _5_tl_writer_js_1.TLWriter()
|
|
52
52
|
.writeInt64(this.id)
|
|
53
53
|
.writeInt32(this.seqNo)
|
|
54
54
|
.writeInt32(calculateLength(this.body))
|
|
@@ -59,12 +59,12 @@ class Message_ {
|
|
|
59
59
|
const id_ = reader.readInt64();
|
|
60
60
|
const seqNo = reader.readInt32();
|
|
61
61
|
const length = reader.readInt32();
|
|
62
|
-
reader = new
|
|
62
|
+
reader = new _4_tl_reader_js_1.TLReader(reader.read(length));
|
|
63
63
|
const cid = reader.readInt32(false);
|
|
64
64
|
let body;
|
|
65
65
|
{
|
|
66
|
-
if (cid ==
|
|
67
|
-
body =
|
|
66
|
+
if (cid == _6_rpc_result_js_1.RPCResult[_1_tl_object_js_1.id]) {
|
|
67
|
+
body = _6_rpc_result_js_1.RPCResult.deserialize(reader.buffer);
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
70
|
body = reader.readObject(cid);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageContainer = void 0;
|
|
4
4
|
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const _4_tl_reader_js_1 = require("./4_tl_reader.js");
|
|
6
|
+
const _5_tl_writer_js_1 = require("./5_tl_writer.js");
|
|
7
|
+
const _7_message_js_1 = require("./7_message.js");
|
|
8
8
|
class MessageContainer {
|
|
9
9
|
static get [_1_tl_object_js_1.id]() {
|
|
10
10
|
return 0x73F1F8DC;
|
|
@@ -33,10 +33,10 @@ class MessageContainer {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
[_1_tl_object_js_1.serialize]() {
|
|
36
|
-
const writer = new
|
|
36
|
+
const writer = new _5_tl_writer_js_1.TLWriter();
|
|
37
37
|
writer.writeInt64(this.id);
|
|
38
38
|
writer.writeInt32(this.seqNo);
|
|
39
|
-
writer.writeInt32(8 + this.messages.map(
|
|
39
|
+
writer.writeInt32(8 + this.messages.map(_7_message_js_1.calculateLength).reduce((a, b) => a + b));
|
|
40
40
|
writer.writeInt32(MessageContainer[_1_tl_object_js_1.id], false);
|
|
41
41
|
writer.writeInt32(this.messages.length);
|
|
42
42
|
for (const message of this.messages) {
|
|
@@ -45,11 +45,11 @@ class MessageContainer {
|
|
|
45
45
|
return writer.buffer;
|
|
46
46
|
}
|
|
47
47
|
static deserialize(buffer) {
|
|
48
|
-
const reader = new
|
|
48
|
+
const reader = new _4_tl_reader_js_1.TLReader(buffer);
|
|
49
49
|
const length = reader.readInt32();
|
|
50
50
|
const messages = new Array();
|
|
51
51
|
for (let i = 0; i < length; i++) {
|
|
52
|
-
messages.push(
|
|
52
|
+
messages.push(_7_message_js_1.Message_.deserialize(reader));
|
|
53
53
|
}
|
|
54
54
|
return messages;
|
|
55
55
|
}
|
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.constructChatPhoto = void 0;
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
4
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
5
|
-
const
|
|
6
|
+
const _file_id_js_1 = require("./_file_id.js");
|
|
6
7
|
function constructChatPhoto(photo, chatId, chatAccessHash) {
|
|
7
8
|
const smallFileId_ = {
|
|
8
|
-
type:
|
|
9
|
+
type: _file_id_js_1.FileType.ProfilePhoto,
|
|
9
10
|
dcId: photo.dc_id,
|
|
10
|
-
location: { type: "photo", id: photo.photo_id, accessHash: 0n, source: { type:
|
|
11
|
+
location: { type: "photo", id: photo.photo_id, accessHash: 0n, source: { type: _file_id_js_1.PhotoSourceType.ChatPhotoSmall, chatId: BigInt(chatId), chatAccessHash } },
|
|
11
12
|
};
|
|
12
|
-
const smallFileId = (0,
|
|
13
|
-
const smallFileUniqueId = (0,
|
|
13
|
+
const smallFileId = (0, _file_id_js_1.serializeFileId)(smallFileId_);
|
|
14
|
+
const smallFileUniqueId = (0, _file_id_js_1.toUniqueFileId)(smallFileId_);
|
|
14
15
|
const bigFileId_ = {
|
|
15
|
-
type:
|
|
16
|
+
type: _file_id_js_1.FileType.ProfilePhoto,
|
|
16
17
|
dcId: photo.dc_id,
|
|
17
|
-
location: { type: "photo", id: photo.photo_id, accessHash: 0n, source: { type:
|
|
18
|
+
location: { type: "photo", id: photo.photo_id, accessHash: 0n, source: { type: _file_id_js_1.PhotoSourceType.ChatPhotoBig, chatId: BigInt(chatId), chatAccessHash } },
|
|
18
19
|
};
|
|
19
|
-
const bigFileId = (0,
|
|
20
|
-
const bigFileUniqueId = (0,
|
|
20
|
+
const bigFileId = (0, _file_id_js_1.serializeFileId)(bigFileId_);
|
|
21
|
+
const bigFileUniqueId = (0, _file_id_js_1.toUniqueFileId)(bigFileId_);
|
|
21
22
|
if (photo instanceof _2_tl_js_1.types.ChatPhoto) {
|
|
22
|
-
return {
|
|
23
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
23
24
|
smallFileId,
|
|
24
25
|
smallFileUniqueId,
|
|
25
26
|
bigFileId,
|
|
26
27
|
bigFileUniqueId,
|
|
27
28
|
hasVideo: photo.has_video || false,
|
|
28
|
-
|
|
29
|
+
strippedThumbnail: photo.stripped_thumb,
|
|
30
|
+
});
|
|
29
31
|
}
|
|
30
32
|
else {
|
|
31
|
-
return {
|
|
33
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
32
34
|
personal: photo.personal ? true : undefined,
|
|
33
35
|
smallFileId,
|
|
34
36
|
smallFileUniqueId,
|
|
35
37
|
bigFileId,
|
|
36
38
|
bigFileUniqueId,
|
|
37
39
|
hasVideo: photo.has_video || false,
|
|
38
|
-
|
|
40
|
+
strippedThumbnail: photo.stripped_thumb,
|
|
41
|
+
});
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
exports.constructChatPhoto = constructChatPhoto;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
|
-
import { EntityGetter } from "./
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
3
3
|
/** @unlisted */
|
|
4
4
|
export type MessageEntityType = "mention" | "hashtag" | "botCommand" | "url" | "email" | "bold" | "italic" | "code" | "pre" | "textLink" | "textMention" | "cashtag" | "phoneNumber" | "underline" | "strikethrough" | "blockquote" | "bankCard" | "spoiler" | "customEmoji";
|
|
5
5
|
/** @unlisted */
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.constructThumbnail = void 0;
|
|
4
4
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
5
|
-
const
|
|
5
|
+
const _file_id_js_1 = require("./_file_id.js");
|
|
6
6
|
function constructThumbnail(size, file) {
|
|
7
|
-
const type = file instanceof _2_tl_js_1.types.Photo ?
|
|
8
|
-
const fileType = file instanceof _2_tl_js_1.types.Photo ?
|
|
7
|
+
const type = file instanceof _2_tl_js_1.types.Photo ? _file_id_js_1.FileType.Photo : _file_id_js_1.FileType.Thumbnail;
|
|
8
|
+
const fileType = file instanceof _2_tl_js_1.types.Photo ? _file_id_js_1.FileType.Photo : _file_id_js_1.FileType.Document;
|
|
9
9
|
const fileId_ = {
|
|
10
10
|
type,
|
|
11
11
|
dcId: file.dc_id,
|
|
12
12
|
fileReference: file.file_reference,
|
|
13
|
-
location: { type: "photo", id: file.id, accessHash: file.access_hash, source: { type:
|
|
13
|
+
location: { type: "photo", id: file.id, accessHash: file.access_hash, source: { type: _file_id_js_1.PhotoSourceType.Thumbnail, fileType, thumbnailType: size.type.charCodeAt(0) } },
|
|
14
14
|
};
|
|
15
15
|
return {
|
|
16
|
-
fileId: (0,
|
|
17
|
-
fileUniqueId: (0,
|
|
16
|
+
fileId: (0, _file_id_js_1.serializeFileId)(fileId_),
|
|
17
|
+
fileUniqueId: (0, _file_id_js_1.toUniqueFileId)(fileId_),
|
|
18
18
|
width: size.w,
|
|
19
19
|
height: size.h,
|
|
20
20
|
fileSize: size.size,
|
package/script/types/1_photo.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.constructPhoto = void 0;
|
|
4
4
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const _file_id_js_1 = require("./_file_id.js");
|
|
6
|
+
const _file_id_js_2 = require("./_file_id.js");
|
|
7
7
|
const _0_thumbnail_js_1 = require("./0_thumbnail.js");
|
|
8
8
|
function constructPhoto(photo) {
|
|
9
9
|
const sizes = photo.sizes
|
|
@@ -20,7 +20,7 @@ function constructPhoto(photo) {
|
|
|
20
20
|
const largest = sizes.slice(-1)[0];
|
|
21
21
|
const { dc_id: dcId, id, access_hash: accessHash, file_reference: fileReference } = photo;
|
|
22
22
|
const fileId_ = {
|
|
23
|
-
type:
|
|
23
|
+
type: _file_id_js_2.FileType.Photo,
|
|
24
24
|
dcId,
|
|
25
25
|
fileReference,
|
|
26
26
|
location: {
|
|
@@ -28,15 +28,15 @@ function constructPhoto(photo) {
|
|
|
28
28
|
id,
|
|
29
29
|
accessHash,
|
|
30
30
|
source: {
|
|
31
|
-
type:
|
|
32
|
-
fileType:
|
|
31
|
+
type: _file_id_js_1.PhotoSourceType.Thumbnail,
|
|
32
|
+
fileType: _file_id_js_2.FileType.Photo,
|
|
33
33
|
thumbnailType: largest.type.charCodeAt(0),
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
return {
|
|
38
|
-
fileId: (0,
|
|
39
|
-
fileUniqueId: (0,
|
|
38
|
+
fileId: (0, _file_id_js_2.serializeFileId)(fileId_),
|
|
39
|
+
fileUniqueId: (0, _file_id_js_2.toUniqueFileId)(fileId_),
|
|
40
40
|
width: largest.w,
|
|
41
41
|
height: largest.h,
|
|
42
42
|
fileSize: largest.size,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
3
|
+
import { User } from "./1_user.js";
|
|
4
|
+
export interface BusinessConnection {
|
|
5
|
+
id: string;
|
|
6
|
+
user: User;
|
|
7
|
+
date: Date;
|
|
8
|
+
canReply: boolean;
|
|
9
|
+
isEnabled: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function constructBusinessConnection(connection: types.BotBusinessConnection, getEntity: EntityGetter): Promise<BusinessConnection>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructBusinessConnection = void 0;
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _1_user_js_1 = require("./1_user.js");
|
|
7
|
+
async function constructBusinessConnection(connection, getEntity) {
|
|
8
|
+
return {
|
|
9
|
+
id: connection.connection_id,
|
|
10
|
+
user: (0, _1_user_js_1.constructUser)((await getEntity(new _2_tl_js_1.types.PeerUser(connection)))),
|
|
11
|
+
date: (0, _1_utilities_js_1.fromUnixTimestamp)(connection.date),
|
|
12
|
+
canReply: !!connection.can_reply,
|
|
13
|
+
isEnabled: !connection.disabled,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.constructBusinessConnection = constructBusinessConnection;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
2
3
|
import { ChatAdministratorRights } from "./0_chat_administrator_rights.js";
|
|
3
4
|
import { ChatMemberRights } from "./0_chat_member_rights.js";
|
|
4
|
-
import { EntityGetter } from "./1__getters.js";
|
|
5
5
|
import { User } from "./1_user.js";
|
|
6
6
|
/** @unlisted */
|
|
7
7
|
export type ChatMemberStatus = "creator" | "administrator" | "member" | "restricted" | "left" | "banned";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
2
3
|
import { Location } from "./0_location.js";
|
|
3
|
-
import { EntityGetter } from "./1__getters.js";
|
|
4
4
|
import { User } from "./1_user.js";
|
|
5
5
|
/** A chosen inline result. */
|
|
6
6
|
export interface ChosenInlineResult {
|
package/script/types/2_game.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.constructGame = void 0;
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
-
const
|
|
6
|
+
const _file_id_js_1 = require("./_file_id.js");
|
|
7
7
|
const _1_animation_js_1 = require("./1_animation.js");
|
|
8
8
|
const _1_photo_js_1 = require("./1_photo.js");
|
|
9
9
|
function constructGame(media_) {
|
|
@@ -11,7 +11,7 @@ function constructGame(media_) {
|
|
|
11
11
|
const document_ = game_.document ? game_.document[_2_tl_js_1.as](_2_tl_js_1.types.Document) : undefined;
|
|
12
12
|
const fileId_ = document_
|
|
13
13
|
? {
|
|
14
|
-
type:
|
|
14
|
+
type: _file_id_js_1.FileType.Animation,
|
|
15
15
|
dcId: document_.dc_id,
|
|
16
16
|
fileReference: document_.file_reference,
|
|
17
17
|
location: { type: "common", id: document_.id, accessHash: document_.access_hash },
|
|
@@ -22,7 +22,7 @@ function constructGame(media_) {
|
|
|
22
22
|
description: media_.game.description,
|
|
23
23
|
photo: (0, _1_photo_js_1.constructPhoto)(game_.photo[_2_tl_js_1.as](_2_tl_js_1.types.Photo)),
|
|
24
24
|
animation: fileId_ && document_
|
|
25
|
-
? (0, _1_animation_js_1.constructAnimation)(document_, document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeVideo), document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeFilename), (0,
|
|
25
|
+
? (0, _1_animation_js_1.constructAnimation)(document_, document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeVideo), document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeFilename), (0, _file_id_js_1.serializeFileId)(fileId_), (0, _file_id_js_1.toUniqueFileId)(fileId_))
|
|
26
26
|
: undefined,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
|
+
import { UsernameResolver } from "./_getters.js";
|
|
2
3
|
import { LoginUrl } from "./0_login_url.js";
|
|
3
4
|
import { MiniAppInfo } from "./0_mini_app_info.js";
|
|
4
|
-
import { UsernameResolver } from "./1__getters.js";
|
|
5
5
|
/** @unlisted */
|
|
6
6
|
export interface _InlineKeyboardButtonBase {
|
|
7
7
|
text: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
2
3
|
import { Location } from "./0_location.js";
|
|
3
|
-
import { EntityGetter } from "./1__getters.js";
|
|
4
4
|
import { User } from "./1_user.js";
|
|
5
5
|
/** An incoming inline query. */
|
|
6
6
|
export interface InlineQuery {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
-
import { EntityGetter } from "./
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
3
3
|
import { ChatP } from "./1_chat_p.js";
|
|
4
4
|
import { ReactionCount } from "./1_reaction_count.js";
|
|
5
5
|
/** Information on the reactions made to a channel post. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
2
3
|
import { Reaction } from "./0_reaction.js";
|
|
3
|
-
import { EntityGetter } from "./1__getters.js";
|
|
4
4
|
import { ChatP } from "./1_chat_p.js";
|
|
5
5
|
import { User } from "./1_user.js";
|
|
6
6
|
/** The reactions of a user to a messages in a group. */
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.constructStoryContent = void 0;
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
-
const
|
|
6
|
+
const _file_id_js_1 = require("./_file_id.js");
|
|
7
7
|
const _1_photo_js_1 = require("./1_photo.js");
|
|
8
8
|
const _1_video_js_1 = require("./1_video.js");
|
|
9
9
|
function constructStoryContent(media) {
|
|
@@ -23,9 +23,9 @@ function constructStoryContent(media) {
|
|
|
23
23
|
if (!video) {
|
|
24
24
|
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
25
25
|
}
|
|
26
|
-
const fileId_ = { type:
|
|
27
|
-
const fileUniqueId = (0,
|
|
28
|
-
const fileId = (0,
|
|
26
|
+
const fileId_ = { type: _file_id_js_1.FileType.Video, dcId: document.dc_id, fileReference: document.file_reference, location: { type: "common", id: document.id, accessHash: document.access_hash } };
|
|
27
|
+
const fileUniqueId = (0, _file_id_js_1.toUniqueFileId)(fileId_);
|
|
28
|
+
const fileId = (0, _file_id_js_1.serializeFileId)(fileId_);
|
|
29
29
|
const video_ = (0, _1_video_js_1.constructVideo)(document, video, undefined, fileId, fileUniqueId);
|
|
30
30
|
return { video: video_ };
|
|
31
31
|
}
|
package/{esm/types/1_story_interactive_area.d.ts → script/types/2_story_interactive_area.d.ts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
2
3
|
import { Location } from "./0_location.js";
|
|
3
4
|
import { MessageReference } from "./0_message_reference.js";
|
|
4
5
|
import { Reaction } from "./0_reaction.js";
|
|
5
|
-
import { Venue } from "./
|
|
6
|
-
import { EntityGetter } from "./1__getters.js";
|
|
6
|
+
import { Venue } from "./1_venue.js";
|
|
7
7
|
/** @unlisted */
|
|
8
8
|
export interface StoryInteractiveAreaPosition {
|
|
9
9
|
xPercentage: number;
|
|
@@ -5,7 +5,7 @@ const _1_utilities_js_1 = require("../1_utilities.js");
|
|
|
5
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
6
|
const _0_location_js_1 = require("./0_location.js");
|
|
7
7
|
const _0_reaction_js_1 = require("./0_reaction.js");
|
|
8
|
-
const
|
|
8
|
+
const _1_venue_js_1 = require("./1_venue.js");
|
|
9
9
|
function constructStoryInteractiveAreaPosition(position) {
|
|
10
10
|
return {
|
|
11
11
|
xPercentage: position.x,
|
|
@@ -25,7 +25,7 @@ function constructStoryInteractiveArea(area) {
|
|
|
25
25
|
return { position, location };
|
|
26
26
|
}
|
|
27
27
|
else if (area instanceof _2_tl_js_1.types.MediaAreaVenue) {
|
|
28
|
-
const venue = (0,
|
|
28
|
+
const venue = (0, _1_venue_js_1.constructVenue)(area);
|
|
29
29
|
return { position, venue };
|
|
30
30
|
}
|
|
31
31
|
else if (area instanceof _2_tl_js_1.types.MediaAreaSuggestedReaction) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
|
-
import { UsernameResolver } from "./
|
|
2
|
+
import { UsernameResolver } from "./_getters.js";
|
|
3
3
|
import { KeyboardButton } from "./1_keyboard_button.js";
|
|
4
4
|
import { InlineKeyboardButton } from "./2_inline_keyboard_button.js";
|
|
5
5
|
/** @unlisted */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
2
3
|
import { MessageEntity } from "./0_message_entity.js";
|
|
3
|
-
import { EntityGetter } from "./1__getters.js";
|
|
4
4
|
import { ChatP } from "./1_chat_p.js";
|
|
5
|
-
import { StoryInteractiveArea } from "./1_story_interactive_area.js";
|
|
6
5
|
import { StoryPrivacy } from "./1_story_privacy.js";
|
|
7
6
|
import { StoryContent } from "./2_story_content.js";
|
|
8
7
|
import { StoryInteractions } from "./2_story_interactions.js";
|
|
8
|
+
import { StoryInteractiveArea } from "./2_story_interactive_area.js";
|
|
9
9
|
/** A story. */
|
|
10
10
|
export interface Story {
|
|
11
11
|
out: boolean;
|
package/script/types/3_story.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.constructStory = void 0;
|
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _0_message_entity_js_1 = require("./0_message_entity.js");
|
|
6
6
|
const _1_chat_p_js_1 = require("./1_chat_p.js");
|
|
7
|
-
const _1_story_interactive_area_js_1 = require("./1_story_interactive_area.js");
|
|
8
7
|
const _1_story_privacy_js_1 = require("./1_story_privacy.js");
|
|
9
8
|
const _2_story_content_js_1 = require("./2_story_content.js");
|
|
10
9
|
const _2_story_interactions_js_1 = require("./2_story_interactions.js");
|
|
10
|
+
const _2_story_interactive_area_js_1 = require("./2_story_interactive_area.js");
|
|
11
11
|
async function constructStory(story, peer, getEntity) {
|
|
12
12
|
const id = story.id;
|
|
13
13
|
const entity = await getEntity(peer);
|
|
@@ -16,7 +16,7 @@ async function constructStory(story, peer, getEntity) {
|
|
|
16
16
|
}
|
|
17
17
|
const chat = (0, _1_chat_p_js_1.constructChatP)(entity);
|
|
18
18
|
const date = (0, _1_utilities_js_1.fromUnixTimestamp)(story.date);
|
|
19
|
-
const interactiveAreas = (story.media_areas ?? []).map(
|
|
19
|
+
const interactiveAreas = (story.media_areas ?? []).map(_2_story_interactive_area_js_1.constructStoryInteractiveArea);
|
|
20
20
|
const highlighted = story.pinned ? true : false;
|
|
21
21
|
const content = (0, _2_story_content_js_1.constructStoryContent)(story.media);
|
|
22
22
|
const caption = story.caption;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
|
+
import { UsernameResolver } from "./_getters.js";
|
|
2
3
|
import { MessageEntity } from "./0_message_entity.js";
|
|
3
4
|
import { ParseMode } from "./0_parse_mode.js";
|
|
4
|
-
import { UsernameResolver } from "./1__getters.js";
|
|
5
5
|
import { InputMessageContent } from "./1_input_message_content.js";
|
|
6
6
|
import { ReplyMarkupInlineKeyboard } from "./3_reply_markup.js";
|
|
7
7
|
/** @unlisted */
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.inlineQueryResultToTlObject = void 0;
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
-
const
|
|
6
|
+
const _file_id_js_1 = require("./_file_id.js");
|
|
7
7
|
const _3_reply_markup_js_1 = require("./3_reply_markup.js");
|
|
8
8
|
// deno-lint-ignore no-explicit-any
|
|
9
9
|
async function inlineQueryResultToTlObject(result_, parseText, usernameResolver) {
|
|
@@ -178,7 +178,7 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
|
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
else if (fileId_ != null) {
|
|
181
|
-
const fileId = (0,
|
|
181
|
+
const fileId = (0, _file_id_js_1.deserializeFileId)(fileId_);
|
|
182
182
|
return new _2_tl_js_1.types.InputBotInlineResultDocument({
|
|
183
183
|
id,
|
|
184
184
|
type: type == "document" ? "file" : type,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { enums } from "../2_tl.js";
|
|
3
|
+
import { EntityGetter } from "./_getters.js";
|
|
3
4
|
import { Contact } from "./0_contact.js";
|
|
4
5
|
import { Dice } from "./0_dice.js";
|
|
5
6
|
import { LinkPreview } from "./0_link_preview.js";
|
|
6
7
|
import { Location } from "./0_location.js";
|
|
7
8
|
import { MessageEntity } from "./0_message_entity.js";
|
|
8
|
-
import { Venue } from "./0_venue.js";
|
|
9
9
|
import { Voice } from "./0_voice.js";
|
|
10
|
-
import { EntityGetter } from "./1__getters.js";
|
|
11
10
|
import { Animation } from "./1_animation.js";
|
|
12
11
|
import { Audio } from "./1_audio.js";
|
|
13
12
|
import { ChatP } from "./1_chat_p.js";
|
|
@@ -19,6 +18,7 @@ import { Poll } from "./1_poll.js";
|
|
|
19
18
|
import { ReplyQuote } from "./1_reply_quote.js";
|
|
20
19
|
import { Sticker, StickerSetNameGetter } from "./1_sticker.js";
|
|
21
20
|
import { User } from "./1_user.js";
|
|
21
|
+
import { Venue } from "./1_venue.js";
|
|
22
22
|
import { VideoNote } from "./1_video_note.js";
|
|
23
23
|
import { Video } from "./1_video.js";
|
|
24
24
|
import { Game } from "./2_game.js";
|
|
@@ -84,6 +84,9 @@ export interface _MessageBase {
|
|
|
84
84
|
forwards?: number;
|
|
85
85
|
/** The message's reply markup. */
|
|
86
86
|
replyMarkup?: ReplyMarkup;
|
|
87
|
+
businessConnectionId?: string;
|
|
88
|
+
senderBoostCount?: number;
|
|
89
|
+
viaBusinessBot?: User;
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
89
92
|
* Properties shared between media message types.
|
|
@@ -464,5 +467,8 @@ export interface MessageGetter {
|
|
|
464
467
|
(chatId: number, messageId: number): MaybePromise<Message | null>;
|
|
465
468
|
}
|
|
466
469
|
type Message_MessageGetter = MessageGetter | null;
|
|
467
|
-
export declare function constructMessage(message_: enums.Message, getEntity: EntityGetter, getMessage: Message_MessageGetter, getStickerSetName: StickerSetNameGetter, getReply_?: boolean
|
|
470
|
+
export declare function constructMessage(message_: enums.Message, getEntity: EntityGetter, getMessage: Message_MessageGetter, getStickerSetName: StickerSetNameGetter, getReply_?: boolean, business?: {
|
|
471
|
+
connectionId: string;
|
|
472
|
+
replyToMessage?: enums.Message;
|
|
473
|
+
}): Promise<Message>;
|
|
468
474
|
export {};
|