@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
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { id, serialize } from "./1_tl_object.js";
|
|
2
|
-
import { TLReader } from "./
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { TLReader } from "./4_tl_reader.js";
|
|
3
|
+
import { TLWriter } from "./5_tl_writer.js";
|
|
4
|
+
import { RPCResult } from "./6_rpc_result.js";
|
|
5
5
|
export function calculateLength(object) {
|
|
6
6
|
let length = 0;
|
|
7
7
|
if (Array.isArray(object)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { id, name, serialize } from "./1_tl_object.js";
|
|
2
|
-
import { TLReader } from "./
|
|
3
|
-
import { TLWriter } from "./
|
|
4
|
-
import { calculateLength, Message_ } from "./
|
|
2
|
+
import { TLReader } from "./4_tl_reader.js";
|
|
3
|
+
import { TLWriter } from "./5_tl_writer.js";
|
|
4
|
+
import { calculateLength, Message_ } from "./7_message.js";
|
|
5
5
|
export class MessageContainer {
|
|
6
6
|
static get [id]() {
|
|
7
7
|
return 0x73F1F8DC;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { cleanObject } from "../1_utilities.js";
|
|
1
2
|
import { types } from "../2_tl.js";
|
|
2
|
-
import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./
|
|
3
|
+
import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
3
4
|
export function constructChatPhoto(photo, chatId, chatAccessHash) {
|
|
4
5
|
const smallFileId_ = {
|
|
5
6
|
type: FileType.ProfilePhoto,
|
|
@@ -16,22 +17,24 @@ export function constructChatPhoto(photo, chatId, chatAccessHash) {
|
|
|
16
17
|
const bigFileId = serializeFileId(bigFileId_);
|
|
17
18
|
const bigFileUniqueId = toUniqueFileId(bigFileId_);
|
|
18
19
|
if (photo instanceof types.ChatPhoto) {
|
|
19
|
-
return {
|
|
20
|
+
return cleanObject({
|
|
20
21
|
smallFileId,
|
|
21
22
|
smallFileUniqueId,
|
|
22
23
|
bigFileId,
|
|
23
24
|
bigFileUniqueId,
|
|
24
25
|
hasVideo: photo.has_video || false,
|
|
25
|
-
|
|
26
|
+
strippedThumbnail: photo.stripped_thumb,
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
28
|
-
return {
|
|
30
|
+
return cleanObject({
|
|
29
31
|
personal: photo.personal ? true : undefined,
|
|
30
32
|
smallFileId,
|
|
31
33
|
smallFileUniqueId,
|
|
32
34
|
bigFileId,
|
|
33
35
|
bigFileUniqueId,
|
|
34
36
|
hasVideo: photo.has_video || false,
|
|
35
|
-
|
|
37
|
+
strippedThumbnail: photo.stripped_thumb,
|
|
38
|
+
});
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -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 */
|
package/esm/types/0_thumbnail.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
-
import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./
|
|
2
|
+
import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
3
3
|
export function constructThumbnail(size, file) {
|
|
4
4
|
const type = file instanceof types.Photo ? FileType.Photo : FileType.Thumbnail;
|
|
5
5
|
const fileType = file instanceof types.Photo ? FileType.Photo : FileType.Document;
|
package/esm/types/1_photo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
-
import { PhotoSourceType } from "./
|
|
3
|
-
import { FileType, serializeFileId, toUniqueFileId } from "./
|
|
2
|
+
import { PhotoSourceType } from "./_file_id.js";
|
|
3
|
+
import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
4
4
|
import { constructThumbnail } from "./0_thumbnail.js";
|
|
5
5
|
export function constructPhoto(photo) {
|
|
6
6
|
const sizes = photo.sizes
|
|
@@ -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,12 @@
|
|
|
1
|
+
import { fromUnixTimestamp } from "../1_utilities.js";
|
|
2
|
+
import { types } from "../2_tl.js";
|
|
3
|
+
import { constructUser } from "./1_user.js";
|
|
4
|
+
export async function constructBusinessConnection(connection, getEntity) {
|
|
5
|
+
return {
|
|
6
|
+
id: connection.connection_id,
|
|
7
|
+
user: constructUser((await getEntity(new types.PeerUser(connection)))),
|
|
8
|
+
date: fromUnixTimestamp(connection.date),
|
|
9
|
+
canReply: !!connection.can_reply,
|
|
10
|
+
isEnabled: !connection.disabled,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -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/esm/types/2_game.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cleanObject } from "../1_utilities.js";
|
|
2
2
|
import { as, types } from "../2_tl.js";
|
|
3
|
-
import { FileType, serializeFileId, toUniqueFileId } from "./
|
|
3
|
+
import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
4
4
|
import { constructAnimation } from "./1_animation.js";
|
|
5
5
|
import { constructPhoto } from "./1_photo.js";
|
|
6
6
|
export function constructGame(media_) {
|
|
@@ -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. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UNREACHABLE } from "../1_utilities.js";
|
|
2
2
|
import { as, types } from "../2_tl.js";
|
|
3
|
-
import { FileType, serializeFileId, toUniqueFileId } from "./
|
|
3
|
+
import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
4
4
|
import { constructPhoto } from "./1_photo.js";
|
|
5
5
|
import { constructVideo } from "./1_video.js";
|
|
6
6
|
export function constructStoryContent(media) {
|
package/{script/types/1_story_interactive_area.d.ts → esm/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;
|
|
@@ -2,7 +2,7 @@ import { UNREACHABLE } from "../1_utilities.js";
|
|
|
2
2
|
import { chatIdToPeer, peerToChatId, types } from "../2_tl.js";
|
|
3
3
|
import { constructLocation } from "./0_location.js";
|
|
4
4
|
import { constructReaction, reactionToTlObject } from "./0_reaction.js";
|
|
5
|
-
import { constructVenue } from "./
|
|
5
|
+
import { constructVenue } from "./1_venue.js";
|
|
6
6
|
function constructStoryInteractiveAreaPosition(position) {
|
|
7
7
|
return {
|
|
8
8
|
xPercentage: position.x,
|
|
@@ -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 */
|
package/esm/types/3_story.d.ts
CHANGED
|
@@ -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/esm/types/3_story.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { cleanObject, fromUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
|
|
2
2
|
import { constructMessageEntity } from "./0_message_entity.js";
|
|
3
3
|
import { constructChatP } from "./1_chat_p.js";
|
|
4
|
-
import { constructStoryInteractiveArea } from "./1_story_interactive_area.js";
|
|
5
4
|
import { constructStoryPrivacy } from "./1_story_privacy.js";
|
|
6
5
|
import { constructStoryContent } from "./2_story_content.js";
|
|
7
6
|
import { constructStoryInteractions } from "./2_story_interactions.js";
|
|
7
|
+
import { constructStoryInteractiveArea } from "./2_story_interactive_area.js";
|
|
8
8
|
export async function constructStory(story, peer, getEntity) {
|
|
9
9
|
const id = story.id;
|
|
10
10
|
const entity = await getEntity(peer);
|
|
@@ -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 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UNREACHABLE } from "../1_utilities.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
|
-
import { deserializeFileId } from "./
|
|
3
|
+
import { deserializeFileId } from "./_file_id.js";
|
|
4
4
|
import { replyMarkupToTlObject } from "./3_reply_markup.js";
|
|
5
5
|
// deno-lint-ignore no-explicit-any
|
|
6
6
|
export async function inlineQueryResultToTlObject(result_, parseText, usernameResolver) {
|
package/esm/types/4_message.d.ts
CHANGED
|
@@ -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 {};
|
package/esm/types/4_message.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { cleanObject, fromUnixTimestamp, getLogger, UNREACHABLE, ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
2
2
|
import { as, types } from "../2_tl.js";
|
|
3
|
-
import { FileType, toUniqueFileId } from "./
|
|
4
|
-
import { serializeFileId } from "./
|
|
3
|
+
import { FileType, toUniqueFileId } from "./_file_id.js";
|
|
4
|
+
import { serializeFileId } from "./_file_id.js";
|
|
5
5
|
import { constructContact } from "./0_contact.js";
|
|
6
6
|
import { constructDice } from "./0_dice.js";
|
|
7
7
|
import { constructLinkPreview } from "./0_link_preview.js";
|
|
8
8
|
import { constructLocation } from "./0_location.js";
|
|
9
9
|
import { constructMessageEntity } from "./0_message_entity.js";
|
|
10
|
-
import { constructVenue } from "./0_venue.js";
|
|
11
10
|
import { constructVoice } from "./0_voice.js";
|
|
12
11
|
import { constructAnimation } from "./1_animation.js";
|
|
13
12
|
import { constructAudio } from "./1_audio.js";
|
|
@@ -20,6 +19,7 @@ import { constructPoll } from "./1_poll.js";
|
|
|
20
19
|
import { constructReplyQuote } from "./1_reply_quote.js";
|
|
21
20
|
import { constructSticker } from "./1_sticker.js";
|
|
22
21
|
import { constructUser } from "./1_user.js";
|
|
22
|
+
import { constructVenue } from "./1_venue.js";
|
|
23
23
|
import { constructVideoNote } from "./1_video_note.js";
|
|
24
24
|
import { constructVideo } from "./1_video.js";
|
|
25
25
|
import { constructGame } from "./2_game.js";
|
|
@@ -249,7 +249,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
|
|
|
249
249
|
}
|
|
250
250
|
return { ...message, unsupported: true };
|
|
251
251
|
}
|
|
252
|
-
export async function constructMessage(message_, getEntity, getMessage, getStickerSetName, getReply_ = true) {
|
|
252
|
+
export async function constructMessage(message_, getEntity, getMessage, getStickerSetName, getReply_ = true, business) {
|
|
253
253
|
if (!(message_ instanceof types.Message) && !(message_ instanceof types.MessageService)) {
|
|
254
254
|
UNREACHABLE();
|
|
255
255
|
}
|
|
@@ -299,6 +299,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
|
|
|
299
299
|
forwards: message_.forwards,
|
|
300
300
|
isTopicMessage: false,
|
|
301
301
|
hasProtectedContent: message_.noforwards || false,
|
|
302
|
+
senderBoostCount: message_.from_boosts_applied,
|
|
302
303
|
};
|
|
303
304
|
if (message_.reactions) {
|
|
304
305
|
const recentReactions = message_.reactions.recent_reactions ?? [];
|
|
@@ -310,7 +311,14 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
|
|
|
310
311
|
}
|
|
311
312
|
message.replyToMessageId = message_.reply_to.reply_to_msg_id;
|
|
312
313
|
}
|
|
313
|
-
if (
|
|
314
|
+
if (business) {
|
|
315
|
+
message.businessConnectionId = business.connectionId;
|
|
316
|
+
if (business.replyToMessage) {
|
|
317
|
+
message.replyToMessageId = business.replyToMessage.id;
|
|
318
|
+
message.replyToMessage = await constructMessage(business.replyToMessage, getEntity, getMessage, getStickerSetName, false, { connectionId: business.connectionId });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else if (getReply_) {
|
|
314
322
|
Object.assign(message, await getReply(message_, chat_, getMessage));
|
|
315
323
|
}
|
|
316
324
|
Object.assign(message, await getSender(message_, getEntity));
|
|
@@ -326,6 +334,15 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
|
|
|
326
334
|
UNREACHABLE();
|
|
327
335
|
}
|
|
328
336
|
}
|
|
337
|
+
if (message_.via_business_bot_id != undefined) {
|
|
338
|
+
const viaBusinessBot = await getEntity(new types.PeerUser({ user_id: message_.via_business_bot_id }));
|
|
339
|
+
if (viaBusinessBot) {
|
|
340
|
+
message.viaBusinessBot = constructUser(viaBusinessBot);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
UNREACHABLE();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
329
346
|
if (message_.post_author != undefined) {
|
|
330
347
|
message.authorSignature = message_.post_author;
|
|
331
348
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { enums, types } from "../2_tl.js";
|
|
2
|
-
import { EntityGetter } from "./
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
3
3
|
import { User } from "./1_user.js";
|
|
4
4
|
import { Message, MessageGetter } from "./4_message.js";
|
|
5
5
|
/** A received callback query. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { InputError } from "../0_errors.js";
|
|
1
2
|
import { base64DecodeUrlSafe, base64EncodeUrlSafe, cleanObject, UNREACHABLE } from "../1_utilities.js";
|
|
2
3
|
import { peerToChatId, serialize, TLReader, types } from "../2_tl.js";
|
|
3
4
|
import { constructUser } from "./1_user.js";
|
|
4
|
-
const ERR_INVALID_INLINE_MESSAGE_ID = new
|
|
5
|
+
const ERR_INVALID_INLINE_MESSAGE_ID = new InputError("Invalid inline message ID");
|
|
5
6
|
export function deserializeInlineMessageId(inlineMessageId) {
|
|
6
7
|
try {
|
|
7
8
|
const buffer = base64DecodeUrlSafe(inlineMessageId);
|
package/esm/types/5_chat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { enums, types } from "../2_tl.js";
|
|
2
|
+
import { EntityGetter } from "./_getters.js";
|
|
2
3
|
import { ChatPhotoChat, ChatPhotoUser } from "./0_chat_photo.js";
|
|
3
|
-
import { EntityGetter } from "./1__getters.js";
|
|
4
4
|
import { ChatPChannel, ChatPGroup, ChatPPrivate, ChatPSupergroup } from "./1_chat_p.js";
|
|
5
5
|
import { StickerSetNameGetter } from "./1_sticker.js";
|
|
6
6
|
import { Message, MessageGetter } from "./4_message.js";
|
package/esm/types/6_update.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AuthorizationState } from "./0_authorization_state.js";
|
|
|
2
2
|
import { ConnectionState } from "./0_connection_state.js";
|
|
3
3
|
import { MessageReference } from "./0_message_reference.js";
|
|
4
4
|
import { StoryReference } from "./0_story_reference.js";
|
|
5
|
+
import { BusinessConnection } from "./2_business_connection.js";
|
|
5
6
|
import { ChosenInlineResult } from "./2_chosen_inline_result.js";
|
|
6
7
|
import { InlineQuery } from "./2_inline_query.js";
|
|
7
8
|
import { MessageInteractions } from "./2_message_interactions.js";
|
|
@@ -100,6 +101,7 @@ export interface UpdateEditedMessage {
|
|
|
100
101
|
export interface UpdateDeletedMessages {
|
|
101
102
|
/** The deleted messages. */
|
|
102
103
|
deletedMessages: MessageReference[];
|
|
104
|
+
businessConnectionId?: string;
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
107
|
* A callback query was made (a user presses an inline button). Bot-only.
|
|
@@ -214,6 +216,13 @@ export interface UpdateDeletedStory {
|
|
|
214
216
|
export interface UpdateNewStory {
|
|
215
217
|
story: Story;
|
|
216
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* A business connection was added, modified, or removed.
|
|
221
|
+
* @unlisted
|
|
222
|
+
*/
|
|
223
|
+
export interface UpdateBusinessConnection {
|
|
224
|
+
businessConnection: BusinessConnection;
|
|
225
|
+
}
|
|
217
226
|
/** @unlisted */
|
|
218
227
|
export interface UpdateMap {
|
|
219
228
|
message: UpdateNewMessage;
|
|
@@ -234,8 +243,9 @@ export interface UpdateMap {
|
|
|
234
243
|
myChatMember: UpdateMyChatMember;
|
|
235
244
|
deletedStory: UpdateDeletedStory;
|
|
236
245
|
story: UpdateNewStory;
|
|
246
|
+
businessConnection: UpdateBusinessConnection;
|
|
237
247
|
}
|
|
238
248
|
/** @unlisted */
|
|
239
|
-
export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory>;
|
|
249
|
+
export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory & UpdateBusinessConnection>;
|
|
240
250
|
/** An incoming update. */
|
|
241
|
-
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory;
|
|
251
|
+
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory | UpdateBusinessConnection;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InputError } from "../0_errors.js";
|
|
1
2
|
import { base64DecodeUrlSafe, base64EncodeUrlSafe, rleDecode, rleEncode, UNREACHABLE } from "../1_utilities.js";
|
|
2
3
|
import { TLReader, TLWriter } from "../2_tl.js";
|
|
3
4
|
const NEXT_VERSION = 53;
|
|
@@ -215,7 +216,7 @@ function hasFileReference(fileType) {
|
|
|
215
216
|
export function deserializeFileId(fileId) {
|
|
216
217
|
const reader = new TLReader(rleDecode(base64DecodeUrlSafe(fileId)));
|
|
217
218
|
if (reader.buffer[reader.buffer.length - 1] != PERSISTENT_ID_VERSION) {
|
|
218
|
-
throw new
|
|
219
|
+
throw new InputError("Unsupported file ID format");
|
|
219
220
|
}
|
|
220
221
|
const originalType = reader.readInt32();
|
|
221
222
|
const type = ((originalType & ~WEB_LOCATION_FLAG) & ~FILE_REFERENCE_FLAG);
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class MtkrutoError extends Error {
|
|
2
|
+
}
|
|
3
|
+
export declare class ConnectionError extends MtkrutoError {
|
|
4
|
+
}
|
|
5
|
+
export declare class AccessError extends MtkrutoError {
|
|
6
|
+
}
|
|
7
|
+
export declare class InputError extends MtkrutoError {
|
|
8
|
+
}
|
|
9
|
+
export declare class TransportError extends MtkrutoError {
|
|
10
|
+
readonly code: number;
|
|
11
|
+
constructor(code: number);
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransportError = exports.InputError = exports.AccessError = exports.ConnectionError = exports.MtkrutoError = void 0;
|
|
4
|
+
class MtkrutoError extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.MtkrutoError = MtkrutoError;
|
|
7
|
+
class ConnectionError extends MtkrutoError {
|
|
8
|
+
}
|
|
9
|
+
exports.ConnectionError = ConnectionError;
|
|
10
|
+
class AccessError extends MtkrutoError {
|
|
11
|
+
}
|
|
12
|
+
exports.AccessError = AccessError;
|
|
13
|
+
class InputError extends MtkrutoError {
|
|
14
|
+
}
|
|
15
|
+
exports.InputError = InputError;
|
|
16
|
+
class TransportError extends MtkrutoError {
|
|
17
|
+
constructor(code) {
|
|
18
|
+
super(`Transport error: ${code}`);
|
|
19
|
+
Object.defineProperty(this, "code", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: code
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.TransportError = TransportError;
|
package/script/1_utilities.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./utilities/1_base64.js";
|
|
2
1
|
export * from "./utilities/0_bigint.js";
|
|
3
2
|
export * from "./utilities/0_buffer.js";
|
|
4
3
|
export * from "./utilities/0_cache_map.js";
|
|
@@ -12,5 +11,6 @@ export * from "./utilities/0_object.js";
|
|
|
12
11
|
export * from "./utilities/0_rle.js";
|
|
13
12
|
export * from "./utilities/0_types.js";
|
|
14
13
|
export * from "./utilities/1_auth.js";
|
|
14
|
+
export * from "./utilities/1_base64.js";
|
|
15
15
|
export * from "./utilities/1_misc.js";
|
|
16
16
|
export * from "./utilities/1_queue.js";
|