@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,5 +1,5 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
2
|
-
import
|
|
1
|
+
import { MaybePromise } from "../1_utilities.js";
|
|
2
|
+
import { types } from "../2_tl.js";
|
|
3
3
|
import { WebAppInfo } from "./0_web_app_info.js";
|
|
4
4
|
import { LoginUrl } from "./0_login_url.js";
|
|
5
5
|
export declare namespace InlineKeyboardButton {
|
|
@@ -16,7 +16,7 @@ export declare namespace InlineKeyboardButton {
|
|
|
16
16
|
callbackData: string;
|
|
17
17
|
}
|
|
18
18
|
interface WebApp extends Base {
|
|
19
|
-
/** Description of the
|
|
19
|
+
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. */
|
|
20
20
|
webApp: WebAppInfo;
|
|
21
21
|
}
|
|
22
22
|
interface Login extends Base {
|
|
@@ -35,7 +35,7 @@ export declare namespace InlineKeyboardButton {
|
|
|
35
35
|
callbackGame: Record<never, never>;
|
|
36
36
|
}
|
|
37
37
|
interface Pay extends Base {
|
|
38
|
-
/** Specify True
|
|
38
|
+
/** Specify True to send a Pay button */
|
|
39
39
|
pay: boolean;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,46 +1,23 @@
|
|
|
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.inlineKeyboardButtonToTlObject = exports.constructInlineKeyboardButton = 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
|
const _0_web_app_info_js_1 = require("./0_web_app_info.js");
|
|
30
7
|
function constructInlineKeyboardButton(button_) {
|
|
31
|
-
if (button_ instanceof types.KeyboardButtonURL) {
|
|
8
|
+
if (button_ instanceof _2_tl_js_1.types.KeyboardButtonURL) {
|
|
32
9
|
return { text: button_.text, url: button_.url };
|
|
33
10
|
}
|
|
34
|
-
else if (button_ instanceof types.KeyboardButtonCallback) {
|
|
11
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonCallback) {
|
|
35
12
|
return { text: button_.text, callbackData: new TextDecoder().decode(button_.data) };
|
|
36
13
|
}
|
|
37
|
-
else if (button_ instanceof types.KeyboardButtonWebView || button_ instanceof types.KeyboardButtonSimpleWebView) {
|
|
14
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonWebView || button_ instanceof _2_tl_js_1.types.KeyboardButtonSimpleWebView) {
|
|
38
15
|
return { text: button_.text, webApp: (0, _0_web_app_info_js_1.constructWebAppInfo)(button_.url) };
|
|
39
16
|
}
|
|
40
|
-
else if (button_ instanceof types.KeyboardButtonURLAuth) {
|
|
17
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonURLAuth) {
|
|
41
18
|
return { text: button_.text, loginUrl: { url: button_.url, forwardText: button_.fwdText } };
|
|
42
19
|
}
|
|
43
|
-
else if (button_ instanceof types.KeyboardButtonSwitchInline) {
|
|
20
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonSwitchInline) {
|
|
44
21
|
if (button_.samePeer) {
|
|
45
22
|
return { text: button_.text, switchInlineQueryCurrentChat: button_.query };
|
|
46
23
|
}
|
|
@@ -48,47 +25,47 @@ function constructInlineKeyboardButton(button_) {
|
|
|
48
25
|
return { text: button_.text, switchInlineQuery: button_.query };
|
|
49
26
|
}
|
|
50
27
|
}
|
|
51
|
-
else if (button_ instanceof types.KeyboardButtonBuy) {
|
|
28
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonBuy) {
|
|
52
29
|
return { text: button_.text, pay: true };
|
|
53
30
|
}
|
|
54
|
-
else if (button_ instanceof types.KeyboardButtonGame) {
|
|
31
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonGame) {
|
|
55
32
|
return { text: button_.text, callbackGame: {} };
|
|
56
33
|
}
|
|
57
34
|
else {
|
|
58
|
-
(0,
|
|
35
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
59
36
|
}
|
|
60
37
|
}
|
|
61
38
|
exports.constructInlineKeyboardButton = constructInlineKeyboardButton;
|
|
62
39
|
async function inlineKeyboardButtonToTlObject(button, usernameResolver) {
|
|
63
40
|
if ("url" in button) {
|
|
64
|
-
return new types.KeyboardButtonURL({ text: button.text, url: button.url });
|
|
41
|
+
return new _2_tl_js_1.types.KeyboardButtonURL({ text: button.text, url: button.url });
|
|
65
42
|
}
|
|
66
43
|
else if ("callbackData" in button) {
|
|
67
|
-
return new types.KeyboardButtonCallback({ text: button.text, data: new TextEncoder().encode(button.callbackData) });
|
|
44
|
+
return new _2_tl_js_1.types.KeyboardButtonCallback({ text: button.text, data: new TextEncoder().encode(button.callbackData) });
|
|
68
45
|
}
|
|
69
46
|
else if ("webApp" in button) {
|
|
70
|
-
return new types.KeyboardButtonWebView({ text: button.text, url: button.webApp.url });
|
|
47
|
+
return new _2_tl_js_1.types.KeyboardButtonWebView({ text: button.text, url: button.webApp.url });
|
|
71
48
|
}
|
|
72
49
|
else if ("loginUrl" in button) {
|
|
73
|
-
return new types.InputKeyboardButtonURLAuth({
|
|
50
|
+
return new _2_tl_js_1.types.InputKeyboardButtonURLAuth({
|
|
74
51
|
text: button.text,
|
|
75
52
|
url: button.loginUrl.url,
|
|
76
53
|
fwdText: button.loginUrl.forwardText,
|
|
77
|
-
bot: button.loginUrl.botUsername ? await usernameResolver(button.loginUrl.botUsername) : new types.InputUserSelf(),
|
|
54
|
+
bot: button.loginUrl.botUsername ? await usernameResolver(button.loginUrl.botUsername) : new _2_tl_js_1.types.InputUserSelf(),
|
|
78
55
|
requestWriteAccess: button.loginUrl.requestWriteAccess || undefined,
|
|
79
56
|
});
|
|
80
57
|
}
|
|
81
58
|
else if ("switchInlineQuery" in button) {
|
|
82
|
-
return new types.KeyboardButtonSwitchInline({ text: button.text, query: button.switchInlineQuery });
|
|
59
|
+
return new _2_tl_js_1.types.KeyboardButtonSwitchInline({ text: button.text, query: button.switchInlineQuery });
|
|
83
60
|
}
|
|
84
61
|
else if ("switchInlineQueryCurrentChat" in button) {
|
|
85
|
-
return new types.KeyboardButtonSwitchInline({ text: button.text, query: button.switchInlineQueryCurrentChat, samePeer: true });
|
|
62
|
+
return new _2_tl_js_1.types.KeyboardButtonSwitchInline({ text: button.text, query: button.switchInlineQueryCurrentChat, samePeer: true });
|
|
86
63
|
}
|
|
87
64
|
else if ("pay" in button) {
|
|
88
|
-
return new types.KeyboardButtonBuy({ text: button.text });
|
|
65
|
+
return new _2_tl_js_1.types.KeyboardButtonBuy({ text: button.text });
|
|
89
66
|
}
|
|
90
67
|
else {
|
|
91
|
-
(0,
|
|
68
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
92
69
|
}
|
|
93
70
|
}
|
|
94
71
|
exports.inlineKeyboardButtonToTlObject = inlineKeyboardButtonToTlObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
2
|
import { ChatAdministratorRights } from "./0_chat_administrator_rights.js";
|
|
3
3
|
import { KeyboardButtonPollType } from "./0_keyboard_button_poll_type.js";
|
|
4
4
|
import { WebAppInfo } from "./0_web_app_info.js";
|
|
@@ -7,11 +7,11 @@ export declare namespace KeyboardButton {
|
|
|
7
7
|
/** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
|
|
8
8
|
text: string;
|
|
9
9
|
}
|
|
10
|
-
/** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed.
|
|
10
|
+
/** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. */
|
|
11
11
|
interface RequestUser extends Text {
|
|
12
|
-
/** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a
|
|
12
|
+
/** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a "user_shared" service message. Available in private chats only. */
|
|
13
13
|
requestUser: {
|
|
14
|
-
/** Signed 32-bit identifier of the request
|
|
14
|
+
/** Signed 32-bit identifier of the request */
|
|
15
15
|
requestId: number;
|
|
16
16
|
/** Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
|
|
17
17
|
userIsBot?: boolean;
|
|
@@ -19,11 +19,11 @@ export declare namespace KeyboardButton {
|
|
|
19
19
|
userIsPremium?: boolean;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
/** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed.
|
|
22
|
+
/** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */
|
|
23
23
|
interface RequestChat extends Text {
|
|
24
|
-
/** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a
|
|
24
|
+
/** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a "chat_shared" service message. Available in private chats only. */
|
|
25
25
|
requestChat: {
|
|
26
|
-
/** Signed 32-bit identifier of the request
|
|
26
|
+
/** Signed 32-bit identifier of the request */
|
|
27
27
|
requestId: number;
|
|
28
28
|
/** Pass True to request a channel chat, pass False to request a group or a supergroup chat. */
|
|
29
29
|
chatIsChannel: boolean;
|
|
@@ -54,7 +54,7 @@ export declare namespace KeyboardButton {
|
|
|
54
54
|
requestPoll: KeyboardButtonPollType;
|
|
55
55
|
}
|
|
56
56
|
interface WebApp extends Text {
|
|
57
|
-
/** If specified, the described
|
|
57
|
+
/** If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a "web_app_data" service message. Available in private chats only. */
|
|
58
58
|
webApp: WebAppInfo;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,38 +1,15 @@
|
|
|
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.keyboardButtonToTlObject = exports.constructKeyboardButton = 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
|
const _0_chat_administrator_rights_js_1 = require("./0_chat_administrator_rights.js");
|
|
30
7
|
function constructKeyboardButton(button_) {
|
|
31
|
-
if (button_ instanceof types.KeyboardButton) {
|
|
8
|
+
if (button_ instanceof _2_tl_js_1.types.KeyboardButton) {
|
|
32
9
|
return { text: button_.text };
|
|
33
10
|
}
|
|
34
|
-
else if (button_ instanceof types.KeyboardButtonRequestPeer) {
|
|
35
|
-
if (button_.peerType instanceof types.RequestPeerTypeUser) {
|
|
11
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonRequestPeer) {
|
|
12
|
+
if (button_.peerType instanceof _2_tl_js_1.types.RequestPeerTypeUser) {
|
|
36
13
|
return {
|
|
37
14
|
text: button_.text,
|
|
38
15
|
requestUser: {
|
|
@@ -42,7 +19,7 @@ function constructKeyboardButton(button_) {
|
|
|
42
19
|
},
|
|
43
20
|
};
|
|
44
21
|
}
|
|
45
|
-
else if (button_.peerType instanceof types.RequestPeerTypeChat) {
|
|
22
|
+
else if (button_.peerType instanceof _2_tl_js_1.types.RequestPeerTypeChat) {
|
|
46
23
|
const button = {
|
|
47
24
|
text: button_.text,
|
|
48
25
|
requestChat: {
|
|
@@ -62,7 +39,7 @@ function constructKeyboardButton(button_) {
|
|
|
62
39
|
}
|
|
63
40
|
return button;
|
|
64
41
|
}
|
|
65
|
-
else if (button_.peerType instanceof types.RequestPeerTypeBroadcast) {
|
|
42
|
+
else if (button_.peerType instanceof _2_tl_js_1.types.RequestPeerTypeBroadcast) {
|
|
66
43
|
const button = {
|
|
67
44
|
text: button_.text,
|
|
68
45
|
requestChat: {
|
|
@@ -81,44 +58,44 @@ function constructKeyboardButton(button_) {
|
|
|
81
58
|
return button;
|
|
82
59
|
}
|
|
83
60
|
else {
|
|
84
|
-
(0,
|
|
61
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
85
62
|
}
|
|
86
63
|
}
|
|
87
|
-
else if (button_ instanceof types.KeyboardButtonRequestPhone) {
|
|
64
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonRequestPhone) {
|
|
88
65
|
return { text: button_.text, requestContact: true };
|
|
89
66
|
}
|
|
90
|
-
else if (button_ instanceof types.KeyboardButtonRequestGeoLocation) {
|
|
67
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonRequestGeoLocation) {
|
|
91
68
|
return { text: button_.text, requestLocation: true };
|
|
92
69
|
}
|
|
93
|
-
else if (button_ instanceof types.KeyboardButtonRequestPoll) {
|
|
70
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonRequestPoll) {
|
|
94
71
|
const button = { text: button_.text, requestPoll: {} };
|
|
95
72
|
if (button_.quiz) {
|
|
96
73
|
button.requestPoll.type = "quiz";
|
|
97
74
|
}
|
|
98
75
|
return button;
|
|
99
76
|
}
|
|
100
|
-
else if (button_ instanceof types.KeyboardButtonWebView || button_ instanceof types.KeyboardButtonSimpleWebView) {
|
|
77
|
+
else if (button_ instanceof _2_tl_js_1.types.KeyboardButtonWebView || button_ instanceof _2_tl_js_1.types.KeyboardButtonSimpleWebView) {
|
|
101
78
|
return { text: button_.text, webApp: { url: button_.url } };
|
|
102
79
|
}
|
|
103
80
|
else {
|
|
104
|
-
(0,
|
|
81
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
105
82
|
}
|
|
106
83
|
}
|
|
107
84
|
exports.constructKeyboardButton = constructKeyboardButton;
|
|
108
85
|
function keyboardButtonToTlObject(button) {
|
|
109
86
|
if ("requestUser" in button) {
|
|
110
|
-
return new types.KeyboardButtonRequestPeer({
|
|
87
|
+
return new _2_tl_js_1.types.KeyboardButtonRequestPeer({
|
|
111
88
|
text: button.text,
|
|
112
89
|
buttonId: button.requestUser.requestId,
|
|
113
|
-
peerType: new types.RequestPeerTypeUser({ bot: button.requestUser.userIsBot, premium: button.requestUser.userIsPremium }),
|
|
90
|
+
peerType: new _2_tl_js_1.types.RequestPeerTypeUser({ bot: button.requestUser.userIsBot, premium: button.requestUser.userIsPremium }),
|
|
114
91
|
});
|
|
115
92
|
}
|
|
116
93
|
else if ("requestChat" in button) {
|
|
117
94
|
if (!button.requestChat.chatIsChannel) { // GUESS
|
|
118
|
-
return new types.KeyboardButtonRequestPeer({
|
|
95
|
+
return new _2_tl_js_1.types.KeyboardButtonRequestPeer({
|
|
119
96
|
text: button.text,
|
|
120
97
|
buttonId: button.requestChat.requestId,
|
|
121
|
-
peerType: new types.RequestPeerTypeChat({
|
|
98
|
+
peerType: new _2_tl_js_1.types.RequestPeerTypeChat({
|
|
122
99
|
forum: button.requestChat.chatIsForum,
|
|
123
100
|
hasUsername: button.requestChat.chatHasUsername,
|
|
124
101
|
creator: button.requestChat.chatIsCreated || undefined,
|
|
@@ -129,10 +106,10 @@ function keyboardButtonToTlObject(button) {
|
|
|
129
106
|
});
|
|
130
107
|
}
|
|
131
108
|
else {
|
|
132
|
-
return new types.KeyboardButtonRequestPeer({
|
|
109
|
+
return new _2_tl_js_1.types.KeyboardButtonRequestPeer({
|
|
133
110
|
text: button.text,
|
|
134
111
|
buttonId: button.requestChat.requestId,
|
|
135
|
-
peerType: new types.RequestPeerTypeBroadcast({
|
|
112
|
+
peerType: new _2_tl_js_1.types.RequestPeerTypeBroadcast({
|
|
136
113
|
hasUsername: button.requestChat.chatHasUsername,
|
|
137
114
|
creator: button.requestChat.chatIsCreated || undefined,
|
|
138
115
|
botAdminRights: button.requestChat.botAdministratorRights ? (0, _0_chat_administrator_rights_js_1.chatAdministratorRightsToTlObject)(button.requestChat.botAdministratorRights) : undefined,
|
|
@@ -142,19 +119,19 @@ function keyboardButtonToTlObject(button) {
|
|
|
142
119
|
}
|
|
143
120
|
}
|
|
144
121
|
else if ("requestContact" in button) {
|
|
145
|
-
return new types.KeyboardButtonRequestPhone({ text: button.text });
|
|
122
|
+
return new _2_tl_js_1.types.KeyboardButtonRequestPhone({ text: button.text });
|
|
146
123
|
}
|
|
147
124
|
else if ("requestLocation" in button) {
|
|
148
|
-
return new types.KeyboardButtonRequestGeoLocation({ text: button.text });
|
|
125
|
+
return new _2_tl_js_1.types.KeyboardButtonRequestGeoLocation({ text: button.text });
|
|
149
126
|
}
|
|
150
127
|
else if ("requestPoll" in button) {
|
|
151
|
-
return new types.KeyboardButtonRequestPoll({ text: button.text, quiz: button.requestPoll.type == "quiz" });
|
|
128
|
+
return new _2_tl_js_1.types.KeyboardButtonRequestPoll({ text: button.text, quiz: button.requestPoll.type == "quiz" });
|
|
152
129
|
}
|
|
153
130
|
else if ("webApp" in button) {
|
|
154
|
-
return new types.KeyboardButtonWebView({ text: button.text, url: button.webApp.url });
|
|
131
|
+
return new _2_tl_js_1.types.KeyboardButtonWebView({ text: button.text, url: button.webApp.url });
|
|
155
132
|
}
|
|
156
133
|
else {
|
|
157
|
-
return new types.KeyboardButton({ text: button.text });
|
|
134
|
+
return new _2_tl_js_1.types.KeyboardButton({ text: button.text });
|
|
158
135
|
}
|
|
159
136
|
}
|
|
160
137
|
exports.keyboardButtonToTlObject = keyboardButtonToTlObject;
|
|
@@ -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 a photo. */
|
|
4
4
|
export interface Photo {
|
|
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
|
/** Photo width */
|
|
10
10
|
width: number;
|
package/script/types/1_photo.js
CHANGED
|
@@ -1,43 +1,20 @@
|
|
|
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.constructPhoto = 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
|
const _0_thumbnail_js_1 = require("./0_thumbnail.js");
|
|
30
7
|
function constructPhoto(photo) {
|
|
31
8
|
const sizes = photo.sizes
|
|
32
9
|
.map((v) => {
|
|
33
|
-
if (v instanceof types.PhotoSizeProgressive) {
|
|
34
|
-
return new types.PhotoSize({ type: v.type, w: v.w, h: v.h, size: Math.max(...v.sizes) });
|
|
10
|
+
if (v instanceof _2_tl_js_1.types.PhotoSizeProgressive) {
|
|
11
|
+
return new _2_tl_js_1.types.PhotoSize({ type: v.type, w: v.w, h: v.h, size: Math.max(...v.sizes) });
|
|
35
12
|
}
|
|
36
13
|
else {
|
|
37
14
|
return v;
|
|
38
15
|
}
|
|
39
16
|
})
|
|
40
|
-
.filter((v) => v instanceof types.PhotoSize)
|
|
17
|
+
.filter((v) => v instanceof _2_tl_js_1.types.PhotoSize)
|
|
41
18
|
.sort((a, b) => a.size - b.size);
|
|
42
19
|
const largest = sizes.slice(-1)[0];
|
|
43
20
|
const { dcId, id: mediaId, accessHash, fileReference } = photo;
|
package/script/types/1_poll.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
2
|
import { MessageEntity } from "./0_message_entity.js";
|
|
3
3
|
import { PollOption } from "./0_poll_option.js";
|
|
4
4
|
export interface Poll {
|
|
@@ -14,19 +14,19 @@ export interface Poll {
|
|
|
14
14
|
isClosed: boolean;
|
|
15
15
|
/** True, if the poll is anonymous */
|
|
16
16
|
isAnonymous: boolean;
|
|
17
|
-
/** Poll type, currently can be
|
|
17
|
+
/** Poll type, currently can be "regular" or "quiz" */
|
|
18
18
|
type: "regular" | "quiz";
|
|
19
19
|
/** True, if the poll allows multiple answers */
|
|
20
20
|
allowMultipleAnswers?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
/**
|
|
21
|
+
/** Index of the correct answer in `options`. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */
|
|
22
|
+
correctOptionIndex?: number;
|
|
23
|
+
/** Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */
|
|
24
24
|
explanation?: string;
|
|
25
|
-
/**
|
|
25
|
+
/** Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */
|
|
26
26
|
explanationEntities?: MessageEntity[];
|
|
27
|
-
/**
|
|
27
|
+
/** Amount of time in seconds the poll will be active after creation */
|
|
28
28
|
openPeriod?: number;
|
|
29
|
-
/**
|
|
29
|
+
/** Point in time (Unix timestamp) when the poll will be automatically closed */
|
|
30
30
|
closeDate?: Date;
|
|
31
31
|
}
|
|
32
32
|
export declare function constructPoll(media_: types.MessageMediaPoll): Poll;
|
package/script/types/1_poll.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.constructPoll = void 0;
|
|
4
|
-
const
|
|
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 _0_poll_option_js_1 = require("./0_poll_option.js");
|
|
7
7
|
function constructPoll(media_) {
|
|
8
8
|
const poll = media_.poll;
|
|
9
9
|
const correctOption = media_.results.results?.find((v) => v.correct)?.option;
|
|
10
10
|
const correctOptionId = correctOption !== undefined ? poll.answers.findIndex((v) => v.option.every((v, i) => correctOption[i] == v)) : undefined;
|
|
11
|
-
return (0,
|
|
11
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
12
12
|
id: String(poll.id),
|
|
13
13
|
question: poll.question,
|
|
14
14
|
options: poll.answers.map((v) => (0, _0_poll_option_js_1.constructPollOption)(v, media_.results.results ?? [])),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { MaybePromise } from "../1_utilities.js";
|
|
2
|
+
import { types } from "../2_tl.js";
|
|
3
3
|
import { Thumbnail } from "./0_thumbnail.js";
|
|
4
4
|
import { MaskPosition } from "./0_mask_position.js";
|
|
5
5
|
/** This object represents a sticker. */
|
|
6
6
|
export interface Sticker {
|
|
7
7
|
/** Identifier for this file, which can be used to download or reuse the file */
|
|
8
8
|
fileId: string;
|
|
9
|
-
/** 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. */
|
|
9
|
+
/** 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. */
|
|
10
10
|
fileUniqueId: string;
|
|
11
11
|
/** Type of the sticker, currently one of "regular", "mask", "custom_emoji". The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. */
|
|
12
12
|
type: "regular" | "mask" | "custom_emoji";
|
|
@@ -1,38 +1,14 @@
|
|
|
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.constructSticker = 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
|
const _0_thumbnail_js_1 = require("./0_thumbnail.js");
|
|
30
6
|
const _0_mask_position_js_1 = require("./0_mask_position.js");
|
|
31
7
|
async function constructSticker(document, fileId, fileUniqueId, getStickerSetName) {
|
|
32
|
-
const stickerAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeSticker);
|
|
33
|
-
const imageSizeAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeImageSize);
|
|
34
|
-
const videoAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeVideo);
|
|
35
|
-
const setName = await getStickerSetName(stickerAttribute.stickerset[
|
|
8
|
+
const stickerAttribute = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeSticker);
|
|
9
|
+
const imageSizeAttribute = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeImageSize);
|
|
10
|
+
const videoAttribute = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeVideo);
|
|
11
|
+
const setName = await getStickerSetName(stickerAttribute.stickerset[_2_tl_js_1.as](_2_tl_js_1.types.InputStickerSetID));
|
|
36
12
|
return {
|
|
37
13
|
fileId,
|
|
38
14
|
fileUniqueId,
|
|
@@ -42,7 +18,7 @@ async function constructSticker(document, fileId, fileUniqueId, getStickerSetNam
|
|
|
42
18
|
height: imageSizeAttribute ? imageSizeAttribute.h : videoAttribute ? videoAttribute.h : 512,
|
|
43
19
|
isAnimated: document.mimeType == "application/x-tgsticker",
|
|
44
20
|
isVideo: document.mimeType == "video/webm",
|
|
45
|
-
thumbnails: document.thumbs ? document.thumbs.map((v) => v instanceof types.PhotoSize ? (0, _0_thumbnail_js_1.constructThumbnail)(v, document) : null).filter((v) => v) : [],
|
|
21
|
+
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) : [],
|
|
46
22
|
emoji: stickerAttribute.alt || undefined,
|
|
47
23
|
setName,
|
|
48
24
|
premiumAnimation: undefined,
|
package/script/types/1_user.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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
|
/** This object represents a Telegram user or bot. */
|
|
4
5
|
export interface User {
|
|
5
|
-
/** Unique identifier for this user or bot
|
|
6
|
+
/** Unique identifier for this user or bot */
|
|
6
7
|
id: number;
|
|
7
|
-
|
|
8
|
+
color: Color;
|
|
8
9
|
/** True, if this user is a bot */
|
|
9
10
|
isBot: boolean;
|
|
10
11
|
/** User's or bot's first name */
|
package/script/types/1_user.js
CHANGED
|
@@ -1,38 +1,15 @@
|
|
|
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.constructUser = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _0_color_js_1 = require("./0_color.js");
|
|
30
7
|
const _0_chat_photo_js_1 = require("./0_chat_photo.js");
|
|
31
8
|
function constructUser(user_) {
|
|
32
9
|
const id = Number(user_.id);
|
|
33
10
|
const user = {
|
|
34
11
|
id,
|
|
35
|
-
|
|
12
|
+
color: (0, _0_color_js_1.getColor)(id),
|
|
36
13
|
isBot: user_.bot || false,
|
|
37
14
|
firstName: user_.firstName || "",
|
|
38
15
|
lastName: user_.lastName,
|
|
@@ -46,9 +23,9 @@ function constructUser(user_) {
|
|
|
46
23
|
isSupport: user_.support || false,
|
|
47
24
|
addedToAttachmentMenu: user_.attachMenuEnabled || false,
|
|
48
25
|
};
|
|
49
|
-
if (user_.photo instanceof types.UserProfilePhoto) {
|
|
26
|
+
if (user_.photo instanceof _2_tl_js_1.types.UserProfilePhoto) {
|
|
50
27
|
user.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(user_.photo, user.id, user_.accessHash ?? 0n);
|
|
51
28
|
}
|
|
52
|
-
return (0,
|
|
29
|
+
return (0, _1_utilities_js_1.cleanObject)(user);
|
|
53
30
|
}
|
|
54
31
|
exports.constructUser = constructUser;
|
|
@@ -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 a video file. */
|
|
4
4
|
export interface Video {
|
|
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 Video {
|
|
|
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 constructVideo(document: types.Document, videoAttribute: types.DocumentAttributeVideo, fileName: string | undefined, fileId: string, fileUniqueId: string): Video;
|