@mtkruto/node 0.64.1 → 0.65.0
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/3_types.d.ts +10 -10
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +10 -10
- package/esm/client/0_params.d.ts +8 -2
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +8 -2
- package/esm/client/4_link_preview_manager.d.ts +39 -0
- package/esm/client/4_link_preview_manager.d.ts.map +1 -0
- package/esm/client/4_link_preview_manager.js +64 -0
- package/esm/client/5_client.d.ts +9 -2
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +18 -2
- package/esm/types/4_link_preview.d.ts +187 -0
- package/esm/types/4_link_preview.d.ts.map +1 -0
- package/esm/types/4_link_preview.js +218 -0
- package/{script/types/4_message.d.ts → esm/types/5_message.d.ts} +2 -2
- package/esm/types/{4_message.d.ts.map → 5_message.d.ts.map} +1 -1
- package/esm/types/{4_message.js → 5_message.js} +1 -1
- package/{script/types/1_message_content.d.ts → esm/types/5_message_content.d.ts} +3 -3
- package/esm/types/{1_message_content.d.ts.map → 5_message_content.d.ts.map} +1 -1
- package/{script/types/5_callback_query.d.ts → esm/types/6_callback_query.d.ts} +2 -2
- package/esm/types/{5_callback_query.d.ts.map → 6_callback_query.d.ts.map} +1 -1
- package/{script/types/5_chat_list_item.d.ts → esm/types/6_chat_list_item.d.ts} +2 -2
- package/esm/types/{5_chat_list_item.d.ts.map → 6_chat_list_item.d.ts.map} +1 -1
- package/esm/types/{5_chat_list_item.js → 6_chat_list_item.js} +1 -1
- package/esm/types/{4_inline_query_result.d.ts → 6_inline_query_result.d.ts} +2 -2
- package/esm/types/{4_inline_query_result.d.ts.map → 6_inline_query_result.d.ts.map} +1 -1
- package/esm/types/{4_inline_query_result.js → 6_inline_query_result.js} +2 -2
- package/{script/types/5_topic.d.ts → esm/types/6_topic.d.ts} +2 -2
- package/esm/types/{5_topic.d.ts.map → 6_topic.d.ts.map} +1 -1
- package/{script/types/5_inline_query_answer.d.ts → esm/types/7_inline_query_answer.d.ts} +2 -2
- package/esm/types/{5_inline_query_answer.d.ts.map → 7_inline_query_answer.d.ts.map} +1 -1
- package/esm/types/{5_inline_query_answer.js → 7_inline_query_answer.js} +1 -1
- package/{script/types/6_update.d.ts → esm/types/7_update.d.ts} +25 -6
- package/esm/types/7_update.d.ts.map +1 -0
- package/package.json +1 -1
- package/script/3_types.d.ts +10 -10
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +10 -10
- package/script/client/0_params.d.ts +8 -2
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +8 -2
- package/script/client/4_link_preview_manager.d.ts +39 -0
- package/script/client/4_link_preview_manager.d.ts.map +1 -0
- package/script/client/4_link_preview_manager.js +68 -0
- package/script/client/5_client.d.ts +9 -2
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +18 -2
- package/script/types/4_link_preview.d.ts +187 -0
- package/script/types/4_link_preview.d.ts.map +1 -0
- package/script/types/4_link_preview.js +221 -0
- package/{esm/types/4_message.d.ts → script/types/5_message.d.ts} +2 -2
- package/script/types/{4_message.d.ts.map → 5_message.d.ts.map} +1 -1
- package/script/types/{4_message.js → 5_message.js} +2 -2
- package/{esm/types/1_message_content.d.ts → script/types/5_message_content.d.ts} +3 -3
- package/script/types/{1_message_content.d.ts.map → 5_message_content.d.ts.map} +1 -1
- package/{esm/types/5_callback_query.d.ts → script/types/6_callback_query.d.ts} +2 -2
- package/script/types/{5_callback_query.d.ts.map → 6_callback_query.d.ts.map} +1 -1
- package/{esm/types/5_chat_list_item.d.ts → script/types/6_chat_list_item.d.ts} +2 -2
- package/script/types/{5_chat_list_item.d.ts.map → 6_chat_list_item.d.ts.map} +1 -1
- package/script/types/{5_chat_list_item.js → 6_chat_list_item.js} +2 -2
- package/script/types/{4_inline_query_result.d.ts → 6_inline_query_result.d.ts} +2 -2
- package/script/types/{4_inline_query_result.d.ts.map → 6_inline_query_result.d.ts.map} +1 -1
- package/script/types/{4_inline_query_result.js → 6_inline_query_result.js} +2 -2
- package/{esm/types/5_topic.d.ts → script/types/6_topic.d.ts} +2 -2
- package/script/types/{5_topic.d.ts.map → 6_topic.d.ts.map} +1 -1
- package/{esm/types/5_inline_query_answer.d.ts → script/types/7_inline_query_answer.d.ts} +2 -2
- package/script/types/{5_inline_query_answer.d.ts.map → 7_inline_query_answer.d.ts.map} +1 -1
- package/script/types/{5_inline_query_answer.js → 7_inline_query_answer.js} +2 -2
- package/{esm/types/6_update.d.ts → script/types/7_update.d.ts} +25 -6
- package/script/types/7_update.d.ts.map +1 -0
- package/esm/types/0_link_preview.d.ts +0 -35
- package/esm/types/0_link_preview.d.ts.map +0 -1
- package/esm/types/0_link_preview.js +0 -28
- package/esm/types/6_update.d.ts.map +0 -1
- package/script/types/0_link_preview.d.ts +0 -35
- package/script/types/0_link_preview.d.ts.map +0 -1
- package/script/types/0_link_preview.js +0 -31
- package/script/types/6_update.d.ts.map +0 -1
- /package/esm/types/{1_message_content.js → 5_message_content.js} +0 -0
- /package/esm/types/{5_callback_query.js → 6_callback_query.js} +0 -0
- /package/esm/types/{5_topic.js → 6_topic.js} +0 -0
- /package/esm/types/{6_update.js → 7_update.js} +0 -0
- /package/script/types/{1_message_content.js → 5_message_content.js} +0 -0
- /package/script/types/{5_callback_query.js → 6_callback_query.js} +0 -0
- /package/script/types/{5_topic.js → 6_topic.js} +0 -0
- /package/script/types/{6_update.js → 7_update.js} +0 -0
package/esm/client/5_client.js
CHANGED
|
@@ -28,7 +28,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
28
28
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
29
29
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
30
|
};
|
|
31
|
-
var _Client_instances, _Client_clients, _Client_downloadPools, _Client_uploadPools, _Client_guaranteeUpdateDelivery, _Client_accountManager, _Client_botInfoManager, _Client_businessConnectionManager, _Client_fileManager, _Client_networkStatisticsManager, _Client_paymentManager, _Client_reactionManager, _Client_translationsManager, _Client_updateManager, _Client_messageManager, _Client_videoChatManager, _Client_callbackQueryManager, _Client_chatListManager, _Client_chatManager, _Client_forumManager, _Client_giftManager, _Client_inlineQueryManager, _Client_pollManager, _Client_storyManager, _Client_managers, _Client_storage_, _Client_messageStorage_, _Client_parseMode, _Client_apiId, _Client_apiHash, _Client_transportProvider, _Client_publicKeys, _Client_outgoingMessages, _Client_persistCache, _Client_disableUpdates, _Client_authString, _Client_initialDc, _Client_L, _Client_LsignIn, _Client_LupdateGapRecoveryLoop, _Client_LhandleMigrationError, _Client_Lmin, _Client_setMainClient, _Client_newClient, _Client_disconnectAllClients, _Client_client_get, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectMutex, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_getIsPremium, _Client_lastUpdates, _Client_updateGapRecoveryLoopAbortController, _Client_startUpdateGapRecoveryLoop, _Client_updateGapRecoveryLoop, _Client_clientDisconnectionLoopAbortController, _Client_startClientDisconnectionLoop, _Client_clientDisconnectionLoop, _Client_getClient, _Client_getMainClientMutex, _Client_getMainClient, _Client_getDownloadClient, _Client_getUploadPoolSize, _Client_getUploadClient, _Client_setupClient, _Client_importAuthorization, _Client_invoke, _Client_handleInvokeError, _Client_authStringImported, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerChatId, _Client_getInputPeerInner, _Client_getMinInputPeer, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe, _Client_previouslyConnected, _Client_lastConnectionState, _Client_onConnectionStateChange;
|
|
31
|
+
var _Client_instances, _Client_clients, _Client_downloadPools, _Client_uploadPools, _Client_guaranteeUpdateDelivery, _Client_accountManager, _Client_botInfoManager, _Client_businessConnectionManager, _Client_fileManager, _Client_networkStatisticsManager, _Client_paymentManager, _Client_reactionManager, _Client_translationsManager, _Client_updateManager, _Client_messageManager, _Client_videoChatManager, _Client_callbackQueryManager, _Client_chatListManager, _Client_chatManager, _Client_forumManager, _Client_giftManager, _Client_inlineQueryManager, _Client_linkPreviewManager, _Client_pollManager, _Client_storyManager, _Client_managers, _Client_storage_, _Client_messageStorage_, _Client_parseMode, _Client_apiId, _Client_apiHash, _Client_transportProvider, _Client_publicKeys, _Client_outgoingMessages, _Client_persistCache, _Client_disableUpdates, _Client_authString, _Client_initialDc, _Client_L, _Client_LsignIn, _Client_LupdateGapRecoveryLoop, _Client_LhandleMigrationError, _Client_Lmin, _Client_setMainClient, _Client_newClient, _Client_disconnectAllClients, _Client_client_get, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectMutex, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_getIsPremium, _Client_lastUpdates, _Client_updateGapRecoveryLoopAbortController, _Client_startUpdateGapRecoveryLoop, _Client_updateGapRecoveryLoop, _Client_clientDisconnectionLoopAbortController, _Client_startClientDisconnectionLoop, _Client_clientDisconnectionLoop, _Client_getClient, _Client_getMainClientMutex, _Client_getMainClient, _Client_getDownloadClient, _Client_getUploadPoolSize, _Client_getUploadClient, _Client_setupClient, _Client_importAuthorization, _Client_invoke, _Client_handleInvokeError, _Client_authStringImported, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerChatId, _Client_getInputPeerInner, _Client_getMinInputPeer, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe, _Client_previouslyConnected, _Client_lastConnectionState, _Client_onConnectionStateChange;
|
|
32
32
|
import { delay, MINUTE, SECOND, unreachable } from "../0_deps.js";
|
|
33
33
|
import { AccessError, ConnectionError, InputError } from "../0_errors.js";
|
|
34
34
|
import { cleanObject, drop, getLogger, mustPrompt, mustPromptOneOf, Mutex, ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
@@ -62,6 +62,7 @@ import { ChatManager } from "./4_chat_manager.js";
|
|
|
62
62
|
import { ForumManager } from "./4_forum_manager.js";
|
|
63
63
|
import { GiftManager } from "./4_gift_manager.js";
|
|
64
64
|
import { InlineQueryManager } from "./4_inline_query_manager.js";
|
|
65
|
+
import { LinkPreviewManager } from "./4_link_preview_manager.js";
|
|
65
66
|
import { PollManager } from "./4_poll_manager.js";
|
|
66
67
|
import { StoryManager } from "./4_story_manager.js";
|
|
67
68
|
export class Composer extends Composer_ {
|
|
@@ -101,6 +102,7 @@ export class Client extends Composer {
|
|
|
101
102
|
forumManager: __classPrivateFieldGet(this, _Client_forumManager, "f"),
|
|
102
103
|
giftManager: __classPrivateFieldGet(this, _Client_giftManager, "f"),
|
|
103
104
|
inlineQueryManager: __classPrivateFieldGet(this, _Client_inlineQueryManager, "f"),
|
|
105
|
+
linkPreviewManager: __classPrivateFieldGet(this, _Client_linkPreviewManager, "f"),
|
|
104
106
|
pollManager: __classPrivateFieldGet(this, _Client_pollManager, "f"),
|
|
105
107
|
storyManager: __classPrivateFieldGet(this, _Client_storyManager, "f"),
|
|
106
108
|
}, "f"));
|
|
@@ -135,6 +137,7 @@ export class Client extends Composer {
|
|
|
135
137
|
_Client_forumManager.set(this, void 0);
|
|
136
138
|
_Client_giftManager.set(this, void 0);
|
|
137
139
|
_Client_inlineQueryManager.set(this, void 0);
|
|
140
|
+
_Client_linkPreviewManager.set(this, void 0);
|
|
138
141
|
_Client_pollManager.set(this, void 0);
|
|
139
142
|
_Client_storyManager.set(this, void 0);
|
|
140
143
|
// deno-lint-ignore no-explicit-any
|
|
@@ -736,6 +739,7 @@ export class Client extends Composer {
|
|
|
736
739
|
__classPrivateFieldSet(this, _Client_forumManager, new ForumManager({ ...c, messageManager }), "f");
|
|
737
740
|
__classPrivateFieldSet(this, _Client_giftManager, new GiftManager({ ...c, messageManager }), "f");
|
|
738
741
|
__classPrivateFieldSet(this, _Client_inlineQueryManager, new InlineQueryManager({ ...c, messageManager }), "f");
|
|
742
|
+
__classPrivateFieldSet(this, _Client_linkPreviewManager, new LinkPreviewManager({ ...c, messageManager }), "f");
|
|
739
743
|
__classPrivateFieldSet(this, _Client_pollManager, new PollManager({ ...c, messageManager }), "f");
|
|
740
744
|
__classPrivateFieldSet(this, _Client_storyManager, new StoryManager({ ...c, fileManager, messageManager }), "f");
|
|
741
745
|
__classPrivateFieldGet(this, _Client_updateManager, "f").setUpdateHandler(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleUpdate).bind(this));
|
|
@@ -801,7 +805,7 @@ export class Client extends Composer {
|
|
|
801
805
|
unlock();
|
|
802
806
|
}
|
|
803
807
|
}
|
|
804
|
-
async [(_Client_clients = new WeakMap(), _Client_downloadPools = new WeakMap(), _Client_uploadPools = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_paymentManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_translationsManager = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_videoChatManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_chatManager = new WeakMap(), _Client_forumManager = new WeakMap(), _Client_giftManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_pollManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_managers = new WeakMap(), _Client_storage_ = new WeakMap(), _Client_messageStorage_ = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_apiId = new WeakMap(), _Client_apiHash = new WeakMap(), _Client_transportProvider = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_outgoingMessages = new WeakMap(), _Client_persistCache = new WeakMap(), _Client_disableUpdates = new WeakMap(), _Client_authString = new WeakMap(), _Client_initialDc = new WeakMap(), _Client_L = new WeakMap(), _Client_LsignIn = new WeakMap(), _Client_LupdateGapRecoveryLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_Lmin = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectMutex = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_updateGapRecoveryLoopAbortController = new WeakMap(), _Client_clientDisconnectionLoopAbortController = new WeakMap(), _Client_getMainClientMutex = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_authStringImported = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_previouslyConnected = new WeakMap(), _Client_lastConnectionState = new WeakMap(), _Client_instances = new WeakSet(), _Client_setMainClient = function _Client_setMainClient(client) {
|
|
808
|
+
async [(_Client_clients = new WeakMap(), _Client_downloadPools = new WeakMap(), _Client_uploadPools = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_paymentManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_translationsManager = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_videoChatManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_chatManager = new WeakMap(), _Client_forumManager = new WeakMap(), _Client_giftManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_linkPreviewManager = new WeakMap(), _Client_pollManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_managers = new WeakMap(), _Client_storage_ = new WeakMap(), _Client_messageStorage_ = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_apiId = new WeakMap(), _Client_apiHash = new WeakMap(), _Client_transportProvider = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_outgoingMessages = new WeakMap(), _Client_persistCache = new WeakMap(), _Client_disableUpdates = new WeakMap(), _Client_authString = new WeakMap(), _Client_initialDc = new WeakMap(), _Client_L = new WeakMap(), _Client_LsignIn = new WeakMap(), _Client_LupdateGapRecoveryLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_Lmin = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectMutex = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_updateGapRecoveryLoopAbortController = new WeakMap(), _Client_clientDisconnectionLoopAbortController = new WeakMap(), _Client_getMainClientMutex = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_authStringImported = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_previouslyConnected = new WeakMap(), _Client_lastConnectionState = new WeakMap(), _Client_instances = new WeakSet(), _Client_setMainClient = function _Client_setMainClient(client) {
|
|
805
809
|
__classPrivateFieldGet(this, _Client_instances, "m", _Client_disconnectAllClients).call(this);
|
|
806
810
|
__classPrivateFieldSet(this, _Client_clients, [client], "f");
|
|
807
811
|
client.handlers.onUpdate = (updates) => {
|
|
@@ -2125,6 +2129,15 @@ export class Client extends Composer {
|
|
|
2125
2129
|
async transcribeVoice(chatId, messageId) {
|
|
2126
2130
|
return await __classPrivateFieldGet(this, _Client_messageManager, "f").transcribeVoice(chatId, messageId);
|
|
2127
2131
|
}
|
|
2132
|
+
/**
|
|
2133
|
+
* Get the link preview for a message that is about to be sent. User-only.
|
|
2134
|
+
*
|
|
2135
|
+
* @method ms
|
|
2136
|
+
* @param text The message's text.
|
|
2137
|
+
*/
|
|
2138
|
+
async getLinkPreview(text, params) {
|
|
2139
|
+
return await __classPrivateFieldGet(this, _Client_linkPreviewManager, "f").getLinkPreview(text, params);
|
|
2140
|
+
}
|
|
2128
2141
|
//
|
|
2129
2142
|
// ========================= POLLS ========================= //
|
|
2130
2143
|
//
|
|
@@ -3311,6 +3324,9 @@ _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
|
|
|
3311
3324
|
if (__classPrivateFieldGet(this, _Client_inlineQueryManager, "f").canHandleUpdate(update)) {
|
|
3312
3325
|
promises.push(() => __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").handleUpdate(update));
|
|
3313
3326
|
}
|
|
3327
|
+
if (__classPrivateFieldGet(this, _Client_linkPreviewManager, "f").canHandleUpdate(update)) {
|
|
3328
|
+
promises.push(() => __classPrivateFieldGet(this, _Client_linkPreviewManager, "f").handleUpdate(update));
|
|
3329
|
+
}
|
|
3314
3330
|
if (__classPrivateFieldGet(this, _Client_reactionManager, "f").canHandleUpdate(update)) {
|
|
3315
3331
|
promises.push(() => __classPrivateFieldGet(this, _Client_reactionManager, "f").handleUpdate(update));
|
|
3316
3332
|
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { Api } from "../2_tl.js";
|
|
21
|
+
import { Audio } from "./1_audio.js";
|
|
22
|
+
import { Document } from "./1_document.js";
|
|
23
|
+
import { Photo } from "./1_photo.js";
|
|
24
|
+
import { Gift } from "./3_gift.js";
|
|
25
|
+
/**
|
|
26
|
+
* A link preview to be passed as an input.
|
|
27
|
+
* @unlisted
|
|
28
|
+
*/
|
|
29
|
+
export interface InputLinkPreview {
|
|
30
|
+
/** @discriminator */
|
|
31
|
+
type: "input";
|
|
32
|
+
/** Whether link preview is disabled. */
|
|
33
|
+
disable?: boolean;
|
|
34
|
+
/** The URL of the preview. */
|
|
35
|
+
url?: string;
|
|
36
|
+
/** Wether the media is to be shown in a small size. */
|
|
37
|
+
smallMedia?: boolean;
|
|
38
|
+
/** Whether the media is to be shown in a large size. */
|
|
39
|
+
largeMedia?: boolean;
|
|
40
|
+
/** Whether the preview is to be shown above the message's text. */
|
|
41
|
+
aboveText?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A link preview.
|
|
45
|
+
* @unlisted
|
|
46
|
+
*/
|
|
47
|
+
export interface _LinkPreviewBase {
|
|
48
|
+
/** The ID of the link preview. */
|
|
49
|
+
id: string;
|
|
50
|
+
/** Wether the media is to be shown in a small size. */
|
|
51
|
+
smallMedia: boolean;
|
|
52
|
+
/** Whether the media is to be shown in a large size. */
|
|
53
|
+
largeMedia: boolean;
|
|
54
|
+
/** Whether the preview is to be shown above the message's text. */
|
|
55
|
+
aboveText: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A link preview that is being loaded.
|
|
59
|
+
* @unlisted
|
|
60
|
+
*/
|
|
61
|
+
export interface LinkPreviewLoading extends _LinkPreviewBase {
|
|
62
|
+
/** @discriminator */
|
|
63
|
+
type: "loading";
|
|
64
|
+
/** The URL of the link preview. */
|
|
65
|
+
url?: string;
|
|
66
|
+
/** The point in time in which the link preview started to load. */
|
|
67
|
+
date: Date;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A link preview that was not loaded.
|
|
71
|
+
* @unlisted
|
|
72
|
+
*/
|
|
73
|
+
export interface LinkPreviewNotLoaded extends _LinkPreviewBase {
|
|
74
|
+
/** @discriminator */
|
|
75
|
+
type: "notLoaded";
|
|
76
|
+
/** The URL of the link preview. */
|
|
77
|
+
url?: string;
|
|
78
|
+
}
|
|
79
|
+
/** @unlisted */
|
|
80
|
+
export interface _LinkPreviewLoadedBase extends _LinkPreviewBase {
|
|
81
|
+
/** The URL of the link preview. */
|
|
82
|
+
url: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A link preview of an unknown type.
|
|
86
|
+
* @unlisted
|
|
87
|
+
*/
|
|
88
|
+
export interface LinkPreviewUnknown extends _LinkPreviewLoadedBase {
|
|
89
|
+
/** @discriminator */
|
|
90
|
+
type: "unknown";
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* An embedded video link preview.
|
|
94
|
+
* @unlisted
|
|
95
|
+
*/
|
|
96
|
+
export interface LinkPreviewPhoto extends _LinkPreviewLoadedBase {
|
|
97
|
+
/** @discriminator */
|
|
98
|
+
type: "photo";
|
|
99
|
+
photo: Photo;
|
|
100
|
+
}
|
|
101
|
+
/** An embedded video link preview.
|
|
102
|
+
* @unlisted
|
|
103
|
+
*/
|
|
104
|
+
export interface _LinkPreviewEmbeddedBase extends _LinkPreviewLoadedBase {
|
|
105
|
+
embedUrl: string;
|
|
106
|
+
width: number;
|
|
107
|
+
height: number;
|
|
108
|
+
duration: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* An embedded video link preview.
|
|
112
|
+
* @unlisted
|
|
113
|
+
*/
|
|
114
|
+
export interface LinkPreviewEmbeddedVideo extends _LinkPreviewEmbeddedBase {
|
|
115
|
+
/** @discriminator */
|
|
116
|
+
type: "embeddedVideo";
|
|
117
|
+
thumbnail?: Photo;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* An embedded video link preview.
|
|
121
|
+
* @unlisted
|
|
122
|
+
*/
|
|
123
|
+
export interface LinkPreviewExternalVideo extends _LinkPreviewEmbeddedBase {
|
|
124
|
+
/** @discriminator */
|
|
125
|
+
type: "externalVideo";
|
|
126
|
+
mimeType: string;
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
duration: number;
|
|
130
|
+
}
|
|
131
|
+
/** A video link preview.
|
|
132
|
+
* @unlisted
|
|
133
|
+
*/
|
|
134
|
+
export interface LinkPreviewVideo extends _LinkPreviewLoadedBase {
|
|
135
|
+
/** @discriminator */
|
|
136
|
+
type: "video";
|
|
137
|
+
video: Document;
|
|
138
|
+
startTimestamp?: number;
|
|
139
|
+
thumbnail?: Photo;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* An embedded audio link preview.
|
|
143
|
+
* @unlisted
|
|
144
|
+
*/
|
|
145
|
+
export interface LinkPreviewEmbeddedAudio extends _LinkPreviewEmbeddedBase {
|
|
146
|
+
/** @discriminator */
|
|
147
|
+
type: "embeddedAudio";
|
|
148
|
+
duration: number;
|
|
149
|
+
width: number;
|
|
150
|
+
height: number;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* An external audio link preview.
|
|
154
|
+
* @unlisted
|
|
155
|
+
*/
|
|
156
|
+
export interface LinkPreviewExternalAudio extends _LinkPreviewEmbeddedBase {
|
|
157
|
+
/** @discriminator */
|
|
158
|
+
type: "externalAudio";
|
|
159
|
+
mimeType: string;
|
|
160
|
+
duration: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* An audio link preview.
|
|
164
|
+
* @unlisted
|
|
165
|
+
*/
|
|
166
|
+
export interface LinkPreviewAudio extends _LinkPreviewLoadedBase {
|
|
167
|
+
/** @discriminator */
|
|
168
|
+
type: "audio";
|
|
169
|
+
audio: Audio;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* An gift link preview.
|
|
173
|
+
* @unlisted
|
|
174
|
+
*/
|
|
175
|
+
export interface LinkPreviewGift extends _LinkPreviewLoadedBase {
|
|
176
|
+
/** @discriminator */
|
|
177
|
+
type: "gift";
|
|
178
|
+
gift: Gift;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A link preview that was loaded.
|
|
182
|
+
* @unlisted
|
|
183
|
+
*/
|
|
184
|
+
export type LinkPreviewLoaded = LinkPreviewUnknown | LinkPreviewPhoto | LinkPreviewEmbeddedVideo | LinkPreviewExternalVideo | LinkPreviewVideo | LinkPreviewEmbeddedAudio | LinkPreviewExternalAudio | LinkPreviewAudio | LinkPreviewGift;
|
|
185
|
+
export type LinkPreview = InputLinkPreview | LinkPreviewLoading | LinkPreviewNotLoaded | LinkPreviewLoaded;
|
|
186
|
+
export declare function constructLinkPreview(media: Api.messageMediaWebPage, invert?: boolean): LinkPreview;
|
|
187
|
+
//# sourceMappingURL=4_link_preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"4_link_preview.d.ts","sourceRoot":"","sources":["../../src/types/4_link_preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAkB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAqB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAkB,KAAK,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AAElD;;;GAGG;AACH,MAAM,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KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,kBAAkB,GAClB,gBAAgB,GAChB,wBAAwB,GACxB,wBAAwB,GACxB,gBAAgB,GAChB,wBAAwB,GACxB,wBAAwB,GACxB,gBAAgB,GAChB,eAAe,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,oBAAoB,GAAG,iBAAiB,CAAC;AAE3G,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,CA4LlG"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { unreachable } from "../0_deps.js";
|
|
21
|
+
import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
|
|
22
|
+
import { Api } from "../2_tl.js";
|
|
23
|
+
import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
24
|
+
import { constructAudio } from "./1_audio.js";
|
|
25
|
+
import { constructDocument } from "./1_document.js";
|
|
26
|
+
import { constructPhoto } from "./1_photo.js";
|
|
27
|
+
import { constructGift } from "./3_gift.js";
|
|
28
|
+
export function constructLinkPreview(media, invert) {
|
|
29
|
+
if (Api.is("webPageNotModified", media.webpage)) {
|
|
30
|
+
unreachable();
|
|
31
|
+
}
|
|
32
|
+
const id = String(media.webpage.id);
|
|
33
|
+
const smallMedia = !!media.force_small_media;
|
|
34
|
+
const largeMedia = !!media.force_large_media;
|
|
35
|
+
const aboveText = !!invert;
|
|
36
|
+
switch (media.webpage._) {
|
|
37
|
+
case "webPagePending":
|
|
38
|
+
return cleanObject({
|
|
39
|
+
type: "loading",
|
|
40
|
+
id,
|
|
41
|
+
date: fromUnixTimestamp(media.webpage.date),
|
|
42
|
+
url: media.webpage.url,
|
|
43
|
+
smallMedia,
|
|
44
|
+
largeMedia,
|
|
45
|
+
aboveText,
|
|
46
|
+
});
|
|
47
|
+
case "webPageEmpty":
|
|
48
|
+
return cleanObject({
|
|
49
|
+
type: "notLoaded",
|
|
50
|
+
id,
|
|
51
|
+
url: media.webpage.url,
|
|
52
|
+
smallMedia,
|
|
53
|
+
largeMedia,
|
|
54
|
+
aboveText,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const url = media.webpage.url;
|
|
58
|
+
let linkPreview = {
|
|
59
|
+
type: "unknown",
|
|
60
|
+
id,
|
|
61
|
+
url,
|
|
62
|
+
smallMedia,
|
|
63
|
+
largeMedia,
|
|
64
|
+
aboveText,
|
|
65
|
+
};
|
|
66
|
+
switch (media.webpage.type) {
|
|
67
|
+
case "video":
|
|
68
|
+
if (media.webpage.embed_type === "iframe") {
|
|
69
|
+
linkPreview = {
|
|
70
|
+
type: "embeddedVideo",
|
|
71
|
+
id,
|
|
72
|
+
url,
|
|
73
|
+
smallMedia,
|
|
74
|
+
largeMedia,
|
|
75
|
+
aboveText,
|
|
76
|
+
embedUrl: media.webpage.embed_url ?? "",
|
|
77
|
+
width: media.webpage.embed_width ?? 0,
|
|
78
|
+
height: media.webpage.embed_height ?? 0,
|
|
79
|
+
duration: media.webpage.duration ?? 0,
|
|
80
|
+
thumbnail: media.webpage.photo ? constructPhoto(Api.as("photo", media.webpage.photo)) : undefined,
|
|
81
|
+
};
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
else if (media.webpage.document) {
|
|
85
|
+
const document = Api.as("document", media.webpage.document);
|
|
86
|
+
const fileId = {
|
|
87
|
+
type: FileType.Video,
|
|
88
|
+
dcId: document.dc_id,
|
|
89
|
+
fileReference: document.file_reference,
|
|
90
|
+
location: { type: "common", id: document.id, accessHash: document.access_hash },
|
|
91
|
+
};
|
|
92
|
+
const startTimestamp = Number(new URL(media.webpage.url).searchParams.get("t")) || undefined;
|
|
93
|
+
const fileName = document.attributes.find((v) => Api.is("documentAttributeFilename", v));
|
|
94
|
+
linkPreview = {
|
|
95
|
+
type: "video",
|
|
96
|
+
id,
|
|
97
|
+
url,
|
|
98
|
+
smallMedia,
|
|
99
|
+
largeMedia,
|
|
100
|
+
aboveText,
|
|
101
|
+
video: constructDocument(document, fileName ?? { _: "documentAttributeFilename", file_name: "Unknown" }, serializeFileId(fileId), toUniqueFileId(fileId)),
|
|
102
|
+
startTimestamp,
|
|
103
|
+
thumbnail: media.webpage.video_cover_photo ? media.webpage.photo ? constructPhoto(Api.as("photo", media.webpage.photo)) : undefined : undefined,
|
|
104
|
+
};
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
else if (media.webpage.embed_url) {
|
|
108
|
+
linkPreview = {
|
|
109
|
+
type: "externalVideo",
|
|
110
|
+
id,
|
|
111
|
+
url,
|
|
112
|
+
smallMedia,
|
|
113
|
+
largeMedia,
|
|
114
|
+
aboveText,
|
|
115
|
+
embedUrl: media.webpage.embed_url ?? "",
|
|
116
|
+
mimeType: media.webpage.embed_type ?? "",
|
|
117
|
+
width: media.webpage.embed_width ?? 0,
|
|
118
|
+
height: media.webpage.embed_height ?? 0,
|
|
119
|
+
duration: media.webpage.duration ?? 0,
|
|
120
|
+
};
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
else if (media.webpage.photo) {
|
|
124
|
+
linkPreview = {
|
|
125
|
+
type: "photo",
|
|
126
|
+
id,
|
|
127
|
+
url,
|
|
128
|
+
smallMedia,
|
|
129
|
+
largeMedia,
|
|
130
|
+
aboveText,
|
|
131
|
+
photo: constructPhoto(Api.as("photo", media.webpage.photo)),
|
|
132
|
+
};
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
/* falls through */
|
|
136
|
+
case "audio":
|
|
137
|
+
if (media.webpage.embed_type === "iframe") {
|
|
138
|
+
linkPreview = {
|
|
139
|
+
type: "embeddedAudio",
|
|
140
|
+
id,
|
|
141
|
+
url,
|
|
142
|
+
smallMedia,
|
|
143
|
+
largeMedia,
|
|
144
|
+
aboveText,
|
|
145
|
+
embedUrl: media.webpage.embed_url ?? "",
|
|
146
|
+
width: media.webpage.embed_width ?? 0,
|
|
147
|
+
height: media.webpage.embed_height ?? 0,
|
|
148
|
+
duration: media.webpage.duration ?? 0,
|
|
149
|
+
};
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
else if (media.webpage.document) {
|
|
153
|
+
const document = Api.as("document", media.webpage.document);
|
|
154
|
+
const fileId = {
|
|
155
|
+
type: FileType.Audio,
|
|
156
|
+
dcId: document.dc_id,
|
|
157
|
+
fileReference: document.file_reference,
|
|
158
|
+
location: { type: "common", id: document.id, accessHash: document.access_hash },
|
|
159
|
+
};
|
|
160
|
+
const audio = document.attributes.find((v) => Api.is("documentAttributeAudio", v));
|
|
161
|
+
linkPreview = {
|
|
162
|
+
type: "audio",
|
|
163
|
+
id,
|
|
164
|
+
url,
|
|
165
|
+
smallMedia,
|
|
166
|
+
largeMedia,
|
|
167
|
+
aboveText,
|
|
168
|
+
audio: constructAudio(document, audio, serializeFileId(fileId), toUniqueFileId(fileId)),
|
|
169
|
+
};
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
else if (media.webpage.embed_url) {
|
|
173
|
+
linkPreview = {
|
|
174
|
+
type: "externalAudio",
|
|
175
|
+
id,
|
|
176
|
+
url,
|
|
177
|
+
smallMedia,
|
|
178
|
+
largeMedia,
|
|
179
|
+
aboveText,
|
|
180
|
+
embedUrl: media.webpage.embed_url,
|
|
181
|
+
mimeType: media.webpage.embed_type ?? "",
|
|
182
|
+
width: media.webpage.embed_width ?? 0,
|
|
183
|
+
height: media.webpage.embed_height ?? 0,
|
|
184
|
+
duration: media.webpage.duration ?? 0,
|
|
185
|
+
};
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
else if (media.webpage.photo) {
|
|
189
|
+
linkPreview = {
|
|
190
|
+
type: "photo",
|
|
191
|
+
id,
|
|
192
|
+
url,
|
|
193
|
+
smallMedia,
|
|
194
|
+
largeMedia,
|
|
195
|
+
aboveText,
|
|
196
|
+
photo: constructPhoto(Api.as("photo", media.webpage.photo)),
|
|
197
|
+
};
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
case "telegram_nft": {
|
|
202
|
+
const gift = media.webpage.attributes?.find((v) => Api.is("webPageAttributeUniqueStarGift", v))?.gift;
|
|
203
|
+
if (gift) {
|
|
204
|
+
linkPreview = {
|
|
205
|
+
type: "gift",
|
|
206
|
+
id,
|
|
207
|
+
url,
|
|
208
|
+
smallMedia,
|
|
209
|
+
largeMedia,
|
|
210
|
+
aboveText,
|
|
211
|
+
gift: constructGift(gift),
|
|
212
|
+
};
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return cleanObject(linkPreview);
|
|
218
|
+
}
|
|
@@ -23,7 +23,6 @@ import { EntityGetter } from "./_getters.js";
|
|
|
23
23
|
import { Contact } from "./0_contact.js";
|
|
24
24
|
import { Dice } from "./0_dice.js";
|
|
25
25
|
import { Invoice } from "./0_invoice.js";
|
|
26
|
-
import { LinkPreview } from "./0_link_preview.js";
|
|
27
26
|
import { Location } from "./0_location.js";
|
|
28
27
|
import { MessageEntity } from "./0_message_entity.js";
|
|
29
28
|
import { RefundedPayment } from "./0_refunded_payment.js";
|
|
@@ -47,6 +46,7 @@ import { Game } from "./2_game.js";
|
|
|
47
46
|
import { Poll } from "./2_poll.js";
|
|
48
47
|
import { SuccessfulPayment } from "./2_successful_payment.js";
|
|
49
48
|
import { ReplyMarkup } from "./3_reply_markup.js";
|
|
49
|
+
import { LinkPreview } from "./4_link_preview.js";
|
|
50
50
|
/**
|
|
51
51
|
* Properties shared between all message types.
|
|
52
52
|
* @unlisted
|
|
@@ -614,4 +614,4 @@ export declare function constructMessage(message_: Api.Message, getEntity: Entit
|
|
|
614
614
|
replyToMessage?: Api.Message;
|
|
615
615
|
}, poll?: Api.poll, pollResults?: Api.pollResults): Promise<Message>;
|
|
616
616
|
export {};
|
|
617
|
-
//# sourceMappingURL=
|
|
617
|
+
//# sourceMappingURL=5_message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"5_message.d.ts","sourceRoot":"","sources":["../../src/types/5_message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAA6C,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAoB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAoB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3D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,oBAAoB,GACpB,iBAAiB,GACjB,yBAAyB,GACzB,wBAAwB,GACxB,uBAAuB,GACvB,uBAAuB,GACvB,yBAAyB,GACzB,yBAAyB,GACzB,uBAAuB,GACvB,qBAAqB,GACrB,eAAe,GACf,kBAAkB,GAClB,wBAAwB,GACxB,sBAAsB,CAAC;AAE3B,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC5B,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACnE;AAED,KAAK,qBAAqB,GAAG,aAAa,GAAG,IAAI,CAAC;AAuKlD,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,GAAG,CAAC,OAAO,EACrB,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,qBAAqB,EACjC,iBAAiB,EAAE,oBAAoB,EACvC,SAAS,UAAO,EAChB,QAAQ,CAAC,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAAE,EACjE,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,EACf,WAAW,CAAC,EAAE,GAAG,CAAC,WAAW,GAC5B,OAAO,CAAC,OAAO,CAAC,CAuPlB"}
|
|
@@ -25,7 +25,6 @@ import { serializeFileId } from "./_file_id.js";
|
|
|
25
25
|
import { constructContact } from "./0_contact.js";
|
|
26
26
|
import { constructDice } from "./0_dice.js";
|
|
27
27
|
import { constructInvoice } from "./0_invoice.js";
|
|
28
|
-
import { constructLinkPreview } from "./0_link_preview.js";
|
|
29
28
|
import { constructLocation } from "./0_location.js";
|
|
30
29
|
import { constructMessageEntity } from "./0_message_entity.js";
|
|
31
30
|
import { constructRefundedPayment } from "./0_refunded_payment.js";
|
|
@@ -49,6 +48,7 @@ import { constructGame } from "./2_game.js";
|
|
|
49
48
|
import { constructPoll } from "./2_poll.js";
|
|
50
49
|
import { constructSuccessfulPayment } from "./2_successful_payment.js";
|
|
51
50
|
import { constructReplyMarkup } from "./3_reply_markup.js";
|
|
51
|
+
import { constructLinkPreview } from "./4_link_preview.js";
|
|
52
52
|
const L = getLogger("Message");
|
|
53
53
|
const keys = {
|
|
54
54
|
text: ["text"],
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
import { LinkPreview } from "./0_link_preview.js";
|
|
21
20
|
import { MessageEntity } from "./0_message_entity.js";
|
|
22
21
|
import { ParseMode } from "./0_parse_mode.js";
|
|
23
22
|
import { PriceTag } from "./0_price_tag.js";
|
|
23
|
+
import { LinkPreview } from "./4_link_preview.js";
|
|
24
24
|
/**
|
|
25
25
|
* A message content that shares a contact.
|
|
26
26
|
* @unlisted
|
|
@@ -114,6 +114,6 @@ export interface MessageContentInvoice {
|
|
|
114
114
|
sendEmailToProvider?: boolean;
|
|
115
115
|
isFlexible?: boolean;
|
|
116
116
|
}
|
|
117
|
-
/** The content of a message
|
|
117
|
+
/** The content of a message in an inline query result. */
|
|
118
118
|
export type MessageContent = MessageContentText | MessageContentLocation | MessageContentVenue | MessageContentContact | MessageContentInvoice;
|
|
119
|
-
//# sourceMappingURL=
|
|
119
|
+
//# sourceMappingURL=5_message_content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"5_message_content.d.ts","sourceRoot":"","sources":["../../src/types/5_message_content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;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,EAAE,SAAS,CAAC;IACtB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,kCAAkC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,gBAAgB;AAChB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,sBAAsB,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,qBAAqB,CAAC"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { EntityGetter } from "./_getters.js";
|
|
22
22
|
import { User } from "./1_user.js";
|
|
23
|
-
import { Message, MessageGetter } from "./
|
|
23
|
+
import { Message, MessageGetter } from "./5_message.js";
|
|
24
24
|
/** A received callback query. */
|
|
25
25
|
export interface CallbackQuery {
|
|
26
26
|
/** The identifier of the callback query. */
|
|
@@ -40,4 +40,4 @@ export interface CallbackQuery {
|
|
|
40
40
|
}
|
|
41
41
|
export declare function deserializeInlineMessageId(inlineMessageId: string): Promise<Api.InputBotInlineMessageID>;
|
|
42
42
|
export declare function constructCallbackQuery(callbackQuery: Api.updateBotCallbackQuery | Api.updateInlineBotCallbackQuery, getEntity: EntityGetter, getMessage: MessageGetter): Promise<CallbackQuery>;
|
|
43
|
-
//# sourceMappingURL=
|
|
43
|
+
//# sourceMappingURL=6_callback_query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"6_callback_query.d.ts","sourceRoot":"","sources":["../../src/types/6_callback_query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExD,iCAAiC;AACjC,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,IAAI,EAAE,IAAI,CAAC;IACX,uGAAuG;IACvG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oKAAoK;IACpK,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gHAAgH;IAChH,YAAY,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,wBAAsB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAY9G;AAED,wBAAsB,sBAAsB,CAAC,aAAa,EAAE,GAAG,CAAC,sBAAsB,GAAG,GAAG,CAAC,4BAA4B,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAmBrM"}
|