@mtkruto/node 0.1.138 → 0.1.140
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 -36
- package/esm/3_types.js +10 -36
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/5_client.d.ts +1 -1
- package/esm/5_client.js +1 -1
- package/esm/_dnt.polyfills.d.ts +6 -0
- package/esm/client/0_filters.d.ts +60 -0
- package/esm/client/0_filters.js +27 -0
- package/esm/client/0_message.js +2 -2
- package/esm/client/{3_params.d.ts → 0_params.d.ts} +30 -33
- package/esm/client/0_types.d.ts +39 -0
- package/esm/client/0_types.js +2 -0
- package/esm/client/0_utilities.d.ts +1 -47
- package/esm/client/0_utilities.js +0 -27
- package/esm/client/1_composer.d.ts +1 -1
- package/esm/client/1_composer.js +1 -1
- package/esm/client/1_file_manager.d.ts +10 -0
- package/esm/client/1_file_manager.js +241 -0
- package/esm/client/1_update_manager.d.ts +18 -0
- package/esm/client/1_update_manager.js +553 -0
- package/esm/client/2_message_manager.d.ts +40 -0
- package/esm/client/2_message_manager.js +621 -0
- package/esm/client/3_chat_list_manager.d.ts +21 -0
- package/esm/client/3_chat_list_manager.js +353 -0
- package/esm/client/3_reaction_manager.d.ts +16 -0
- package/esm/client/3_reaction_manager.js +61 -0
- package/esm/client/4_client.d.ts +187 -60
- package/esm/client/4_client.js +492 -1699
- package/esm/connection/1_connection_web_socket.js +6 -6
- package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +1 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +524 -0
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/storage/0_storage.d.ts +5 -3
- package/esm/storage/0_storage.js +14 -4
- package/esm/tl/1_tl_object.d.ts +1 -0
- package/esm/tl/1_tl_object.js +24 -0
- package/esm/types/0_bot_command.d.ts +1 -0
- package/esm/types/0_chat_member_rights.d.ts +37 -0
- package/esm/types/0_chat_photo.d.ts +4 -4
- package/esm/types/0_file_source.d.ts +5 -0
- package/esm/types/0_giveaway_parameters.js +2 -1
- package/esm/types/0_id.d.ts +4 -0
- package/esm/types/0_message_entity.d.ts +20 -20
- package/esm/types/1__getters.d.ts +2 -2
- package/esm/types/1_animation.d.ts +1 -1
- package/esm/types/1_bot_command_scope.d.ts +5 -4
- package/esm/types/1_chat_p.d.ts +5 -6
- package/esm/types/1_document.d.ts +1 -0
- package/esm/types/1_input_message_content.d.ts +88 -0
- package/esm/types/1_photo.d.ts +1 -1
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_user.d.ts +1 -1
- package/esm/types/1_video.d.ts +1 -1
- package/esm/types/1_video_note.d.ts +1 -1
- package/esm/types/2_inline_keyboard_button.d.ts +10 -10
- package/esm/types/2_message_reaction_count.d.ts +3 -0
- package/esm/types/2_message_reaction_count.js +17 -1
- package/esm/types/2_message_reactions.d.ts +15 -0
- package/esm/types/2_message_reactions.js +37 -0
- package/esm/types/3_reply_markup.d.ts +42 -0
- package/esm/types/3_reply_markup.js +117 -0
- package/esm/types/4_inline_query_result.d.ts +193 -0
- package/esm/types/{5_inline_query_result.js → 4_inline_query_result.js} +2 -2
- package/esm/types/4_message.d.ts +36 -39
- package/esm/types/4_message.js +7 -24
- package/esm/types/5_callback_query.d.ts +2 -1
- package/esm/types/5_chat.d.ts +8 -5
- package/esm/types/6_update.d.ts +12 -2
- package/esm/utilities/0_buffer.js +9 -6
- package/esm/utilities/0_object.d.ts +1 -1
- package/esm/utilities/0_object.js +1 -6
- package/esm/utilities/1_misc.d.ts +2 -0
- package/esm/utilities/1_misc.js +6 -0
- package/package.json +1 -2
- package/script/3_types.d.ts +10 -36
- package/script/3_types.js +10 -36
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/5_client.d.ts +1 -1
- package/script/5_client.js +1 -1
- package/script/_dnt.polyfills.d.ts +6 -0
- package/script/client/0_filters.d.ts +60 -0
- package/script/client/0_filters.js +31 -0
- package/script/client/0_message.js +1 -1
- package/script/client/{3_params.d.ts → 0_params.d.ts} +30 -33
- package/script/client/0_types.d.ts +39 -0
- package/script/client/0_types.js +6 -0
- package/script/client/0_utilities.d.ts +1 -47
- package/script/client/0_utilities.js +1 -29
- package/script/client/1_composer.d.ts +1 -1
- package/script/client/1_composer.js +2 -2
- package/script/client/1_file_manager.d.ts +10 -0
- package/script/client/1_file_manager.js +245 -0
- package/script/client/1_update_manager.d.ts +18 -0
- package/script/client/1_update_manager.js +557 -0
- package/script/client/2_message_manager.d.ts +40 -0
- package/script/client/2_message_manager.js +625 -0
- package/script/client/3_chat_list_manager.d.ts +21 -0
- package/script/client/3_chat_list_manager.js +357 -0
- package/script/client/3_reaction_manager.d.ts +16 -0
- package/script/client/3_reaction_manager.js +65 -0
- package/script/client/4_client.d.ts +187 -60
- package/script/client/4_client.js +491 -1699
- package/script/connection/1_connection_web_socket.js +5 -5
- package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +550 -0
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/storage/0_storage.d.ts +5 -3
- package/script/storage/0_storage.js +14 -4
- package/script/tl/1_tl_object.d.ts +1 -0
- package/script/tl/1_tl_object.js +24 -0
- package/script/types/0_bot_command.d.ts +1 -0
- package/script/types/0_chat_member_rights.d.ts +37 -0
- package/script/types/0_chat_photo.d.ts +4 -4
- package/script/types/0_file_source.d.ts +5 -0
- package/script/types/0_giveaway_parameters.js +2 -1
- package/script/types/0_id.d.ts +4 -0
- package/script/types/0_message_entity.d.ts +20 -20
- package/script/types/1__getters.d.ts +2 -2
- package/script/types/1_animation.d.ts +1 -1
- package/script/types/1_bot_command_scope.d.ts +5 -4
- package/script/types/1_chat_p.d.ts +5 -6
- package/script/types/1_document.d.ts +1 -0
- package/script/types/1_input_message_content.d.ts +88 -0
- package/script/types/1_photo.d.ts +1 -1
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_user.d.ts +1 -1
- package/script/types/1_video.d.ts +1 -1
- package/script/types/1_video_note.d.ts +1 -1
- package/script/types/2_inline_keyboard_button.d.ts +10 -10
- package/script/types/2_message_reaction_count.d.ts +3 -0
- package/script/types/2_message_reaction_count.js +19 -0
- package/script/types/2_message_reactions.d.ts +15 -0
- package/script/types/2_message_reactions.js +41 -0
- package/script/types/3_reply_markup.d.ts +42 -0
- package/script/types/3_reply_markup.js +122 -0
- package/script/types/4_inline_query_result.d.ts +193 -0
- package/script/types/{5_inline_query_result.js → 4_inline_query_result.js} +3 -3
- package/script/types/4_message.d.ts +36 -39
- package/script/types/4_message.js +6 -23
- package/script/types/5_callback_query.d.ts +2 -1
- package/script/types/5_chat.d.ts +8 -5
- package/script/types/6_update.d.ts +12 -2
- package/script/utilities/0_buffer.js +9 -6
- package/script/utilities/0_object.d.ts +1 -1
- package/script/utilities/0_object.js +1 -6
- package/script/utilities/1_misc.d.ts +2 -0
- package/script/utilities/1_misc.js +9 -1
- package/esm/types/0_chat_id.d.ts +0 -4
- package/esm/types/0_force_reply.d.ts +0 -12
- package/esm/types/0_force_reply.js +0 -17
- package/esm/types/0_input_contact_message_content.d.ts +0 -11
- package/esm/types/0_input_location_message_content.d.ts +0 -15
- package/esm/types/0_input_venue_message_content.d.ts +0 -19
- package/esm/types/0_reply_keyboard_remove.d.ts +0 -10
- package/esm/types/0_reply_keyboard_remove.js +0 -8
- package/esm/types/1_input_invoice_message_content.d.ts +0 -23
- package/esm/types/1_input_text_message_content.d.ts +0 -8
- package/esm/types/1_input_text_message_content.js +0 -1
- package/esm/types/2_input_message_content.d.ts +0 -6
- package/esm/types/2_input_message_content.js +0 -1
- package/esm/types/2_reply_keyboard_markup.d.ts +0 -12
- package/esm/types/2_reply_keyboard_markup.js +0 -37
- package/esm/types/3_inline_keyboard_markup.d.ts +0 -8
- package/esm/types/3_inline_keyboard_markup.js +0 -24
- package/esm/types/4_inline_query_result_article.d.ts +0 -15
- package/esm/types/4_inline_query_result_article.js +0 -1
- package/esm/types/4_inline_query_result_audio.d.ts +0 -17
- package/esm/types/4_inline_query_result_audio.js +0 -1
- package/esm/types/4_inline_query_result_cached_audio.d.ts +0 -14
- package/esm/types/4_inline_query_result_cached_audio.js +0 -1
- package/esm/types/4_inline_query_result_cached_document.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_document.js +0 -1
- package/esm/types/4_inline_query_result_cached_gif.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_gif.js +0 -1
- package/esm/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_mpeg4_gif.js +0 -1
- package/esm/types/4_inline_query_result_cached_photo.d.ts +0 -16
- package/esm/types/4_inline_query_result_cached_photo.js +0 -1
- package/esm/types/4_inline_query_result_cached_sticker.d.ts +0 -9
- package/esm/types/4_inline_query_result_cached_sticker.js +0 -1
- package/esm/types/4_inline_query_result_cached_video.d.ts +0 -16
- package/esm/types/4_inline_query_result_cached_video.js +0 -1
- package/esm/types/4_inline_query_result_cached_voice.d.ts +0 -15
- package/esm/types/4_inline_query_result_cached_voice.js +0 -1
- package/esm/types/4_inline_query_result_contact.d.ts +0 -15
- package/esm/types/4_inline_query_result_contact.js +0 -1
- package/esm/types/4_inline_query_result_document.d.ts +0 -18
- package/esm/types/4_inline_query_result_document.js +0 -1
- package/esm/types/4_inline_query_result_game.d.ts +0 -7
- package/esm/types/4_inline_query_result_game.js +0 -1
- package/esm/types/4_inline_query_result_gif.d.ts +0 -20
- package/esm/types/4_inline_query_result_gif.js +0 -1
- package/esm/types/4_inline_query_result_location.d.ts +0 -18
- package/esm/types/4_inline_query_result_location.js +0 -1
- package/esm/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
- package/esm/types/4_inline_query_result_mpeg4_gif.js +0 -1
- package/esm/types/4_inline_query_result_photo.d.ts +0 -19
- package/esm/types/4_inline_query_result_photo.js +0 -1
- package/esm/types/4_inline_query_result_venue.d.ts +0 -19
- package/esm/types/4_inline_query_result_venue.js +0 -1
- package/esm/types/4_inline_query_result_video.d.ts +0 -21
- package/esm/types/4_inline_query_result_video.js +0 -1
- package/esm/types/4_inline_query_result_voice.d.ts +0 -16
- package/esm/types/4_inline_query_result_voice.js +0 -1
- package/esm/types/4_reply_markup.d.ts +0 -7
- package/esm/types/4_reply_markup.js +0 -22
- package/esm/types/5_inline_query_result.d.ts +0 -28
- package/script/types/0_chat_id.d.ts +0 -4
- package/script/types/0_force_reply.d.ts +0 -12
- package/script/types/0_force_reply.js +0 -22
- package/script/types/0_input_contact_message_content.d.ts +0 -11
- package/script/types/0_input_location_message_content.d.ts +0 -15
- package/script/types/0_input_venue_message_content.d.ts +0 -19
- package/script/types/0_reply_keyboard_remove.d.ts +0 -10
- package/script/types/0_reply_keyboard_remove.js +0 -13
- package/script/types/1_input_invoice_message_content.d.ts +0 -23
- package/script/types/1_input_text_message_content.d.ts +0 -8
- package/script/types/1_input_text_message_content.js +0 -2
- package/script/types/2_input_message_content.d.ts +0 -6
- package/script/types/2_input_message_content.js +0 -2
- package/script/types/2_reply_keyboard_markup.d.ts +0 -12
- package/script/types/2_reply_keyboard_markup.js +0 -42
- package/script/types/3_inline_keyboard_markup.d.ts +0 -8
- package/script/types/3_inline_keyboard_markup.js +0 -29
- package/script/types/4_inline_query_result_article.d.ts +0 -15
- package/script/types/4_inline_query_result_article.js +0 -2
- package/script/types/4_inline_query_result_audio.d.ts +0 -17
- package/script/types/4_inline_query_result_audio.js +0 -2
- package/script/types/4_inline_query_result_cached_audio.d.ts +0 -14
- package/script/types/4_inline_query_result_cached_audio.js +0 -2
- package/script/types/4_inline_query_result_cached_document.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_document.js +0 -2
- package/script/types/4_inline_query_result_cached_gif.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_gif.js +0 -2
- package/script/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_mpeg4_gif.js +0 -2
- package/script/types/4_inline_query_result_cached_photo.d.ts +0 -16
- package/script/types/4_inline_query_result_cached_photo.js +0 -2
- package/script/types/4_inline_query_result_cached_sticker.d.ts +0 -9
- package/script/types/4_inline_query_result_cached_sticker.js +0 -2
- package/script/types/4_inline_query_result_cached_video.d.ts +0 -16
- package/script/types/4_inline_query_result_cached_video.js +0 -2
- package/script/types/4_inline_query_result_cached_voice.d.ts +0 -15
- package/script/types/4_inline_query_result_cached_voice.js +0 -2
- package/script/types/4_inline_query_result_contact.d.ts +0 -15
- package/script/types/4_inline_query_result_contact.js +0 -2
- package/script/types/4_inline_query_result_document.d.ts +0 -18
- package/script/types/4_inline_query_result_document.js +0 -2
- package/script/types/4_inline_query_result_game.d.ts +0 -7
- package/script/types/4_inline_query_result_game.js +0 -2
- package/script/types/4_inline_query_result_gif.d.ts +0 -20
- package/script/types/4_inline_query_result_gif.js +0 -2
- package/script/types/4_inline_query_result_location.d.ts +0 -18
- package/script/types/4_inline_query_result_location.js +0 -2
- package/script/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
- package/script/types/4_inline_query_result_mpeg4_gif.js +0 -2
- package/script/types/4_inline_query_result_photo.d.ts +0 -19
- package/script/types/4_inline_query_result_photo.js +0 -2
- package/script/types/4_inline_query_result_venue.d.ts +0 -19
- package/script/types/4_inline_query_result_venue.js +0 -2
- package/script/types/4_inline_query_result_video.d.ts +0 -21
- package/script/types/4_inline_query_result_video.js +0 -2
- package/script/types/4_inline_query_result_voice.d.ts +0 -16
- package/script/types/4_inline_query_result_voice.js +0 -2
- package/script/types/4_reply_markup.d.ts +0 -7
- package/script/types/4_reply_markup.js +0 -26
- package/script/types/5_inline_query_result.d.ts +0 -28
- /package/esm/{client/3_params.js → _dnt.polyfills.js} +0 -0
- /package/esm/{types/0_chat_id.js → client/0_params.js} +0 -0
- /package/esm/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
- /package/esm/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
- /package/esm/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
- /package/esm/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
- /package/script/{client/3_params.js → _dnt.polyfills.js} +0 -0
- /package/script/{types/0_chat_id.js → client/0_params.js} +0 -0
- /package/script/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
- /package/script/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
- /package/script/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
- /package/script/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructMessageReactions = void 0;
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _0_reaction_js_1 = require("./0_reaction.js");
|
|
7
|
+
const _1_chat_p_js_1 = require("./1_chat_p.js");
|
|
8
|
+
const _1_user_js_1 = require("./1_user.js");
|
|
9
|
+
async function constructMessageReactions(update, getEntity) {
|
|
10
|
+
const date = (0, _1_utilities_js_1.fromUnixTimestamp)(update.date);
|
|
11
|
+
const oldReactions = update.old_reactions.map((v) => (0, _0_reaction_js_1.constructReaction)(v));
|
|
12
|
+
const newReactions = update.new_reactions.map((v) => (0, _0_reaction_js_1.constructReaction)(v));
|
|
13
|
+
const messageId = update.msg_id;
|
|
14
|
+
let entity = await getEntity(update.peer);
|
|
15
|
+
if (!entity) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const chat = (0, _1_chat_p_js_1.constructChatP)(entity);
|
|
19
|
+
let user = undefined;
|
|
20
|
+
let actorChat = undefined;
|
|
21
|
+
entity = await getEntity(update.actor);
|
|
22
|
+
if (!entity) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
if (entity instanceof _2_tl_js_1.types.User) {
|
|
26
|
+
user = (0, _1_user_js_1.constructUser)(entity);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
actorChat = (0, _1_chat_p_js_1.constructChatP)(entity);
|
|
30
|
+
}
|
|
31
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
32
|
+
chat,
|
|
33
|
+
messageId,
|
|
34
|
+
user,
|
|
35
|
+
actorChat,
|
|
36
|
+
date,
|
|
37
|
+
oldReactions,
|
|
38
|
+
newReactions,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.constructMessageReactions = constructMessageReactions;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { enums } from "../2_tl.js";
|
|
2
|
+
import { UsernameResolver } from "./1__getters.js";
|
|
3
|
+
import { KeyboardButton } from "./1_keyboard_button.js";
|
|
4
|
+
import { InlineKeyboardButton } from "./2_inline_keyboard_button.js";
|
|
5
|
+
/** @unlisted */
|
|
6
|
+
export interface ReplyMarkupInlineKeyboard {
|
|
7
|
+
inlineKeyboard: InlineKeyboardButton[][];
|
|
8
|
+
}
|
|
9
|
+
/** @unlisted */
|
|
10
|
+
export interface ReplyMarkupKeyboard {
|
|
11
|
+
keyboard: KeyboardButton[][];
|
|
12
|
+
isPersistent?: boolean;
|
|
13
|
+
resizeKeyboard?: boolean;
|
|
14
|
+
oneTimeKeyboard?: boolean;
|
|
15
|
+
inputFieldPlaceholder?: string;
|
|
16
|
+
selective?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Makes the user's client hide the current custom keyboard.
|
|
20
|
+
* @unlisted
|
|
21
|
+
*/
|
|
22
|
+
export interface ReplyMarkupRemoveKeyboard {
|
|
23
|
+
/** Differentiate from other reply markup types. */
|
|
24
|
+
removeKeyboard: true;
|
|
25
|
+
/** Whether to only affect specific users. If true, only users that were mentioned will be affected along with the author of the replied message if any. */
|
|
26
|
+
selective?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Forces the user's client to select the message as the one that is to be replied.
|
|
30
|
+
* @unlisted
|
|
31
|
+
*/
|
|
32
|
+
export interface ReplyMarkupForceReply {
|
|
33
|
+
/** Differentiate from other reply markup types. */
|
|
34
|
+
forceReply: true;
|
|
35
|
+
/** A placeholder to be shown in the client's message box. */
|
|
36
|
+
inputFieldPlaceholder?: string;
|
|
37
|
+
/** Whether to only affect specific users. If true, only users that were mentioned will be affected along with the author of the replied message if any. */
|
|
38
|
+
selective?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export type ReplyMarkup = ReplyMarkupInlineKeyboard | ReplyMarkupKeyboard | ReplyMarkupRemoveKeyboard | ReplyMarkupForceReply;
|
|
41
|
+
export declare function constructReplyMarkup(replyMarkup: enums.ReplyMarkup): ReplyMarkupInlineKeyboard | ReplyMarkupKeyboard | ReplyMarkupRemoveKeyboard | ReplyMarkupForceReply;
|
|
42
|
+
export declare function replyMarkupToTlObject(replyMarkup: ReplyMarkup, usernameResolver: UsernameResolver): Promise<import("../tl/2_types.js").ReplyKeyboardHide_ | import("../tl/2_types.js").ReplyKeyboardForceReply_ | import("../tl/2_types.js").ReplyKeyboardMarkup_ | import("../tl/2_types.js").ReplyInlineMarkup_>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replyMarkupToTlObject = exports.constructReplyMarkup = void 0;
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _1_keyboard_button_js_1 = require("./1_keyboard_button.js");
|
|
7
|
+
const _2_inline_keyboard_button_js_1 = require("./2_inline_keyboard_button.js");
|
|
8
|
+
function constructInlineKeyboardMarkup(keyboard_) {
|
|
9
|
+
const rows = new Array();
|
|
10
|
+
for (const row_ of keyboard_.rows) {
|
|
11
|
+
const row = new Array();
|
|
12
|
+
for (const button_ of row_.buttons) {
|
|
13
|
+
row.push((0, _2_inline_keyboard_button_js_1.constructInlineKeyboardButton)(button_));
|
|
14
|
+
}
|
|
15
|
+
rows.push(row);
|
|
16
|
+
}
|
|
17
|
+
return { inlineKeyboard: rows };
|
|
18
|
+
}
|
|
19
|
+
async function inlineKeyboardMarkupToTlObject(keyboard, usernameResolver) {
|
|
20
|
+
const rows_ = new Array();
|
|
21
|
+
for (const row of keyboard.inlineKeyboard) {
|
|
22
|
+
const row_ = new Array();
|
|
23
|
+
for (const button of row) {
|
|
24
|
+
row_.push(await (0, _2_inline_keyboard_button_js_1.inlineKeyboardButtonToTlObject)(button, usernameResolver));
|
|
25
|
+
}
|
|
26
|
+
rows_.push(new _2_tl_js_1.types.KeyboardButtonRow({ buttons: row_ }));
|
|
27
|
+
}
|
|
28
|
+
return new _2_tl_js_1.types.ReplyInlineMarkup({ rows: rows_ });
|
|
29
|
+
}
|
|
30
|
+
function constructReplyKeyboardMarkup(keyboard_) {
|
|
31
|
+
const rows = new Array();
|
|
32
|
+
for (const row_ of keyboard_.rows) {
|
|
33
|
+
const row = new Array();
|
|
34
|
+
for (const button_ of row_.buttons) {
|
|
35
|
+
row.push((0, _1_keyboard_button_js_1.constructKeyboardButton)(button_));
|
|
36
|
+
}
|
|
37
|
+
rows.push(row);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
resizeKeyboard: keyboard_.resize || false,
|
|
41
|
+
oneTimeKeyboard: keyboard_.single_use || false,
|
|
42
|
+
selective: keyboard_.selective || false,
|
|
43
|
+
isPersistent: keyboard_.persistent || false,
|
|
44
|
+
keyboard: rows,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function replyKeyboardMarkupToTlObject(replyMarkup) {
|
|
48
|
+
const rows_ = new Array();
|
|
49
|
+
for (const row of replyMarkup.keyboard) {
|
|
50
|
+
const row_ = new Array();
|
|
51
|
+
for (const button of row) {
|
|
52
|
+
row_.push((0, _1_keyboard_button_js_1.keyboardButtonToTlObject)(button));
|
|
53
|
+
}
|
|
54
|
+
rows_.push(new _2_tl_js_1.types.KeyboardButtonRow({ buttons: row_ }));
|
|
55
|
+
}
|
|
56
|
+
return new _2_tl_js_1.types.ReplyKeyboardMarkup({
|
|
57
|
+
resize: replyMarkup.resizeKeyboard || undefined,
|
|
58
|
+
single_use: replyMarkup.oneTimeKeyboard || undefined,
|
|
59
|
+
selective: replyMarkup.selective || undefined,
|
|
60
|
+
persistent: replyMarkup.isPersistent || undefined,
|
|
61
|
+
rows: rows_,
|
|
62
|
+
placeholder: replyMarkup.inputFieldPlaceholder,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function constructReplyKeyboardRemove(replyMarkup_) {
|
|
66
|
+
return (0, _1_utilities_js_1.cleanObject)({ removeKeyboard: true, selective: replyMarkup_.selective });
|
|
67
|
+
}
|
|
68
|
+
function replyKeyboardRemoveToTlObject(replyMarkup) {
|
|
69
|
+
return new _2_tl_js_1.types.ReplyKeyboardHide({ selective: replyMarkup.selective || undefined });
|
|
70
|
+
}
|
|
71
|
+
function constructForceReply(replyMarkup_) {
|
|
72
|
+
const replyMarkup = { forceReply: true };
|
|
73
|
+
if (replyMarkup_.placeholder) {
|
|
74
|
+
replyMarkup.inputFieldPlaceholder = replyMarkup_.placeholder;
|
|
75
|
+
}
|
|
76
|
+
if (replyMarkup_.selective) {
|
|
77
|
+
replyMarkup.selective = true;
|
|
78
|
+
}
|
|
79
|
+
return replyMarkup;
|
|
80
|
+
}
|
|
81
|
+
function forceReplyToTlObject(replyMarkup) {
|
|
82
|
+
return new _2_tl_js_1.types.ReplyKeyboardForceReply({
|
|
83
|
+
selective: replyMarkup.selective || undefined,
|
|
84
|
+
placeholder: replyMarkup.inputFieldPlaceholder,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function constructReplyMarkup(replyMarkup) {
|
|
88
|
+
if (replyMarkup instanceof _2_tl_js_1.types.ReplyKeyboardMarkup) {
|
|
89
|
+
return constructReplyKeyboardMarkup(replyMarkup);
|
|
90
|
+
}
|
|
91
|
+
else if (replyMarkup instanceof _2_tl_js_1.types.ReplyInlineMarkup) {
|
|
92
|
+
return constructInlineKeyboardMarkup(replyMarkup);
|
|
93
|
+
}
|
|
94
|
+
else if (replyMarkup instanceof _2_tl_js_1.types.ReplyKeyboardHide) {
|
|
95
|
+
return constructReplyKeyboardRemove(replyMarkup);
|
|
96
|
+
}
|
|
97
|
+
else if (replyMarkup instanceof _2_tl_js_1.types.ReplyKeyboardForceReply) {
|
|
98
|
+
return constructForceReply(replyMarkup);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.constructReplyMarkup = constructReplyMarkup;
|
|
105
|
+
async function replyMarkupToTlObject(replyMarkup, usernameResolver) {
|
|
106
|
+
if ("inlineKeyboard" in replyMarkup) {
|
|
107
|
+
return await inlineKeyboardMarkupToTlObject(replyMarkup, usernameResolver);
|
|
108
|
+
}
|
|
109
|
+
else if ("keyboard" in replyMarkup) {
|
|
110
|
+
return replyKeyboardMarkupToTlObject(replyMarkup);
|
|
111
|
+
}
|
|
112
|
+
else if ("removeKeyboard" in replyMarkup) {
|
|
113
|
+
return replyKeyboardRemoveToTlObject(replyMarkup);
|
|
114
|
+
}
|
|
115
|
+
else if ("forceReply" in replyMarkup) {
|
|
116
|
+
return forceReplyToTlObject(replyMarkup);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.replyMarkupToTlObject = replyMarkupToTlObject;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { MessageEntity } from "./0_message_entity.js";
|
|
2
|
+
import { ParseMode } from "./0_parse_mode.js";
|
|
3
|
+
import { UsernameResolver } from "./1__getters.js";
|
|
4
|
+
import { InputMessageContent } from "./1_input_message_content.js";
|
|
5
|
+
import { ReplyMarkupInlineKeyboard } from "./3_reply_markup.js";
|
|
6
|
+
/** @unlisted */
|
|
7
|
+
type InlineQueryResultType = "article" | "audio" | "document" | "gif" | "mpeg4Gif" | "photo" | "sticker" | "video" | "voice" | "game" | "location" | "venue";
|
|
8
|
+
/** @unlisted */
|
|
9
|
+
export interface _InlineQueryResultBase {
|
|
10
|
+
type: InlineQueryResultType;
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
/** @unlisted */
|
|
14
|
+
export interface _InlineQueryResultCaptionCommon {
|
|
15
|
+
caption?: string;
|
|
16
|
+
parseMode?: ParseMode;
|
|
17
|
+
captionEntities?: MessageEntity[];
|
|
18
|
+
}
|
|
19
|
+
/** @unlisted */
|
|
20
|
+
export interface _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
21
|
+
inputMessageContent?: InputMessageContent;
|
|
22
|
+
replyMarkup?: ReplyMarkupInlineKeyboard;
|
|
23
|
+
}
|
|
24
|
+
/** @unlisted */
|
|
25
|
+
export interface _InlineQueryResultThumbnailCommon {
|
|
26
|
+
thumbnailUrl?: string;
|
|
27
|
+
thumbnailWidth?: string;
|
|
28
|
+
thumbnailHeight?: string;
|
|
29
|
+
}
|
|
30
|
+
/** @unlisted */
|
|
31
|
+
export interface InlineQueryResultArticle extends _InlineQueryResultBase {
|
|
32
|
+
type: "article";
|
|
33
|
+
title: string;
|
|
34
|
+
inputMessageContent: InputMessageContent;
|
|
35
|
+
description?: string;
|
|
36
|
+
replyMarkup?: ReplyMarkupInlineKeyboard;
|
|
37
|
+
url?: string;
|
|
38
|
+
hideUrl?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** @unlisted */
|
|
41
|
+
export interface InlineQueryResultAudio extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
42
|
+
type: "audio";
|
|
43
|
+
title: string;
|
|
44
|
+
audioUrl: string;
|
|
45
|
+
performer?: string;
|
|
46
|
+
audioDuration?: number;
|
|
47
|
+
}
|
|
48
|
+
/** @unlisted */
|
|
49
|
+
export interface InlineQueryResultCachedAudio extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
50
|
+
type: "audio";
|
|
51
|
+
audioFileId: string;
|
|
52
|
+
}
|
|
53
|
+
/** @unlisted */
|
|
54
|
+
export interface InlineQueryResultCachedDocument extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
55
|
+
type: "document";
|
|
56
|
+
documentFileId: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
}
|
|
59
|
+
/** @unlisted */
|
|
60
|
+
export interface InlineQueryResultCachedGif extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
61
|
+
type: "gif";
|
|
62
|
+
gifFileId: string;
|
|
63
|
+
title?: string;
|
|
64
|
+
}
|
|
65
|
+
/** @unlisted */
|
|
66
|
+
export interface InlineQueryResultCachedMpeg4Gif extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
67
|
+
type: "mpeg4Gif";
|
|
68
|
+
mpeg4FileId: string;
|
|
69
|
+
title?: string;
|
|
70
|
+
}
|
|
71
|
+
/** @unlisted */
|
|
72
|
+
export interface InlineQueryResultCachedPhoto extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
73
|
+
type: "photo";
|
|
74
|
+
photoFileId: string;
|
|
75
|
+
title?: string;
|
|
76
|
+
description?: string;
|
|
77
|
+
}
|
|
78
|
+
/** @unlisted */
|
|
79
|
+
export interface InlineQueryResultCachedSticker extends _InlineQueryResultBase, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
80
|
+
type: "sticker";
|
|
81
|
+
stickerFileId: string;
|
|
82
|
+
}
|
|
83
|
+
/** @unlisted */
|
|
84
|
+
export interface InlineQueryResultCachedVideo extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
85
|
+
type: "video";
|
|
86
|
+
title: string;
|
|
87
|
+
videoFileId: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
}
|
|
90
|
+
/** @unlisted */
|
|
91
|
+
export interface InlineQueryResultCachedVoice extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
92
|
+
type: "voice";
|
|
93
|
+
title: string;
|
|
94
|
+
voiceFileId: string;
|
|
95
|
+
}
|
|
96
|
+
/** @unlisted */
|
|
97
|
+
export interface InlineQueryResultContact extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon, _InlineQueryResultThumbnailCommon {
|
|
98
|
+
type: "game";
|
|
99
|
+
phoneNumber: string;
|
|
100
|
+
firstName: string;
|
|
101
|
+
lastName?: string;
|
|
102
|
+
vcard?: string;
|
|
103
|
+
}
|
|
104
|
+
/** @unlisted */
|
|
105
|
+
export interface InlineQueryResultDocument extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon, _InlineQueryResultThumbnailCommon {
|
|
106
|
+
type: "document";
|
|
107
|
+
title: string;
|
|
108
|
+
documentUrl: string;
|
|
109
|
+
}
|
|
110
|
+
/** @unlisted */
|
|
111
|
+
export interface InlineQueryResultGame extends _InlineQueryResultBase {
|
|
112
|
+
type: "game";
|
|
113
|
+
gameShortName: string;
|
|
114
|
+
replyMarkup?: ReplyMarkupInlineKeyboard;
|
|
115
|
+
}
|
|
116
|
+
/** @unlisted */
|
|
117
|
+
export interface InlineQueryResultGif extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
118
|
+
type: "gif";
|
|
119
|
+
title?: string;
|
|
120
|
+
gifUrl: string;
|
|
121
|
+
gifWidth?: number;
|
|
122
|
+
gifHeight?: number;
|
|
123
|
+
gifDuration?: number;
|
|
124
|
+
thumbnailUrl?: string;
|
|
125
|
+
thumbnailMimeType?: string;
|
|
126
|
+
}
|
|
127
|
+
/** @unlisted */
|
|
128
|
+
export interface InlineQueryResultLocation extends _InlineQueryResultBase, _InlineQueryResultInputMessageContentReplyMarkupCommon, _InlineQueryResultThumbnailCommon {
|
|
129
|
+
type: "location";
|
|
130
|
+
title: string;
|
|
131
|
+
latitude: number;
|
|
132
|
+
longitude: number;
|
|
133
|
+
horizontalAccuracy?: number;
|
|
134
|
+
livePeriod?: number;
|
|
135
|
+
heading?: number;
|
|
136
|
+
proximityAlertRadius?: number;
|
|
137
|
+
}
|
|
138
|
+
/** @unlisted */
|
|
139
|
+
export interface InlineQueryResultMpeg4Gif extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
140
|
+
type: "mpeg4Gif";
|
|
141
|
+
mpeg4Url: string;
|
|
142
|
+
title?: string;
|
|
143
|
+
mpeg4Width?: number;
|
|
144
|
+
mpeg4Height?: number;
|
|
145
|
+
mpeg4Duration?: number;
|
|
146
|
+
thumbnailUrl?: string;
|
|
147
|
+
thumbnailMimeType?: string;
|
|
148
|
+
}
|
|
149
|
+
/** @unlisted */
|
|
150
|
+
export interface InlineQueryResultPhoto extends _InlineQueryResultBase, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
151
|
+
type: "photo";
|
|
152
|
+
photoUrl: string;
|
|
153
|
+
thumbnailUrl: string;
|
|
154
|
+
title?: string;
|
|
155
|
+
description?: string;
|
|
156
|
+
photoWidth?: number;
|
|
157
|
+
photoHeight?: number;
|
|
158
|
+
}
|
|
159
|
+
/** @unlisted */
|
|
160
|
+
export interface InlineQueryResultVenue extends _InlineQueryResultBase, _InlineQueryResultInputMessageContentReplyMarkupCommon, _InlineQueryResultThumbnailCommon {
|
|
161
|
+
type: "venue";
|
|
162
|
+
title: string;
|
|
163
|
+
latitude: number;
|
|
164
|
+
longitude: number;
|
|
165
|
+
address: string;
|
|
166
|
+
fourSquareId?: string;
|
|
167
|
+
foursquareType?: string;
|
|
168
|
+
}
|
|
169
|
+
/** @unlisted */
|
|
170
|
+
export interface InlineQueryResultVideo extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
171
|
+
type: "video";
|
|
172
|
+
title: string;
|
|
173
|
+
description?: string;
|
|
174
|
+
videoUrl: string;
|
|
175
|
+
mimeType: string;
|
|
176
|
+
thumbnailUrl: string;
|
|
177
|
+
videoWidth?: number;
|
|
178
|
+
videoHeight?: number;
|
|
179
|
+
videoDuration?: number;
|
|
180
|
+
}
|
|
181
|
+
/** @unlisted */
|
|
182
|
+
export interface InlineQueryResultVoice extends _InlineQueryResultBase, _InlineQueryResultCaptionCommon, _InlineQueryResultInputMessageContentReplyMarkupCommon {
|
|
183
|
+
type: "voice";
|
|
184
|
+
title: string;
|
|
185
|
+
voiceUrl: string;
|
|
186
|
+
voiceDuration?: number;
|
|
187
|
+
}
|
|
188
|
+
export type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice;
|
|
189
|
+
export declare function inlineQueryResultToTlObject(result_: InlineQueryResult, parseText: (text: string, params?: {
|
|
190
|
+
parseMode?: ParseMode;
|
|
191
|
+
entities?: MessageEntity[];
|
|
192
|
+
}) => readonly [string, any[] | undefined], usernameResolver: UsernameResolver): Promise<import("../tl/2_types.js").InputBotInlineResult_ | import("../tl/2_types.js").InputBotInlineResultDocument_>;
|
|
193
|
+
export {};
|
|
@@ -4,7 +4,7 @@ exports.inlineQueryResultToTlObject = void 0;
|
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
6
|
const _0__file_id_js_1 = require("./0__file_id.js");
|
|
7
|
-
const
|
|
7
|
+
const _3_reply_markup_js_1 = require("./3_reply_markup.js");
|
|
8
8
|
// deno-lint-ignore no-explicit-any
|
|
9
9
|
async function inlineQueryResultToTlObject(result_, parseText, usernameResolver) {
|
|
10
10
|
let document = null;
|
|
@@ -81,7 +81,7 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
|
|
|
81
81
|
fileId_ = result_.gifFileId;
|
|
82
82
|
}
|
|
83
83
|
break;
|
|
84
|
-
case "
|
|
84
|
+
case "mpeg4Gif":
|
|
85
85
|
if ("mpeg4Url" in result_) {
|
|
86
86
|
document = new _2_tl_js_1.types.InputWebDocument({
|
|
87
87
|
url: result_.mpeg4Url,
|
|
@@ -137,7 +137,7 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
|
|
|
137
137
|
}
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
|
-
const replyMarkup = "replyMarkup" in result_ && result_.replyMarkup ? await (0,
|
|
140
|
+
const replyMarkup = "replyMarkup" in result_ && result_.replyMarkup ? await (0, _3_reply_markup_js_1.replyMarkupToTlObject)(result_.replyMarkup, usernameResolver) : undefined;
|
|
141
141
|
if ("thumbnailUrl" in result_ && result_.thumbnailUrl) {
|
|
142
142
|
thumb = new _2_tl_js_1.types.InputWebDocument({
|
|
143
143
|
url: result_.thumbnailUrl,
|