@mtkruto/node 0.150.0 → 0.152.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 +14 -11
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +14 -11
- package/esm/client/0_params.d.ts +18 -8
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +32 -6
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +20 -0
- package/esm/client/3_message_manager.d.ts +5 -1
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +272 -79
- package/esm/client/4_context.d.ts +12 -2
- package/esm/client/4_context.d.ts.map +1 -1
- package/esm/client/4_context.js +32 -1
- package/esm/client/4_inline_query_manager.d.ts +1 -1
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +2 -1
- package/esm/client/4_poll_manager.d.ts +2 -0
- package/esm/client/4_poll_manager.d.ts.map +1 -1
- package/esm/client/4_poll_manager.js +1 -1
- package/esm/client/6_client.d.ts +32 -6
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +42 -6
- package/esm/client/6_client_dispatcher.d.ts +32 -6
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +36 -4
- package/esm/types/0_dice.d.ts +1 -1
- package/esm/types/0_dice.d.ts.map +1 -1
- package/esm/types/0_message_counters.d.ts +1 -1
- package/esm/types/0_message_counters.d.ts.map +1 -1
- package/esm/types/0_upload_progress.d.ts +2 -0
- package/esm/types/0_upload_progress.d.ts.map +1 -1
- package/esm/types/0_voice_transcription.d.ts +1 -1
- package/esm/types/0_voice_transcription.d.ts.map +1 -1
- package/esm/types/1_chat_p.d.ts +2 -0
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +3 -2
- package/esm/types/1_giveaway.d.ts +1 -1
- package/esm/types/1_giveaway.d.ts.map +1 -1
- package/esm/types/1_input_poll_media.d.ts +128 -0
- package/esm/types/1_input_poll_media.d.ts.map +1 -0
- package/esm/types/3_checklist_item.d.ts +1 -1
- package/esm/types/3_checklist_item.d.ts.map +1 -1
- package/esm/types/3_input_poll_option.d.ts +3 -0
- package/esm/types/3_input_poll_option.d.ts.map +1 -1
- package/esm/types/3_message_reactions.d.ts +1 -1
- package/esm/types/3_message_reactions.d.ts.map +1 -1
- package/esm/types/3_rich_text_component.d.ts +6 -7
- package/esm/types/3_rich_text_component.d.ts.map +1 -1
- package/esm/types/4_gift.d.ts +3 -3
- package/esm/types/4_gift.d.ts.map +1 -1
- package/esm/types/4_page_block.d.ts +2 -64
- package/esm/types/4_page_block.d.ts.map +1 -1
- package/esm/types/4_page_block.js +0 -49
- package/esm/types/4_reply_to.d.ts +4 -0
- package/esm/types/4_reply_to.d.ts.map +1 -1
- package/esm/types/5_claimed_gift.d.ts +1 -1
- package/esm/types/5_claimed_gift.d.ts.map +1 -1
- package/esm/types/5_link_preview.d.ts +1 -1
- package/esm/types/5_rich_text.d.ts +36 -0
- package/esm/types/5_rich_text.d.ts.map +1 -0
- package/esm/types/6_message_content.d.ts +14 -7
- package/esm/types/6_message_content.d.ts.map +1 -1
- package/esm/types/6_poll_media.d.ts +84 -0
- package/esm/types/6_poll_media.d.ts.map +1 -0
- package/esm/types/6_poll_media.js +102 -0
- package/esm/types/7_inline_query_result.d.ts +2 -1
- package/esm/types/7_inline_query_result.d.ts.map +1 -1
- package/esm/types/7_inline_query_result.js +52 -13
- package/esm/types/{3_poll_option.d.ts → 7_poll_option.d.ts} +11 -2
- package/esm/types/7_poll_option.d.ts.map +1 -0
- package/esm/types/{3_poll_option.js → 7_poll_option.js} +11 -6
- package/{script/types/4_poll.d.ts → esm/types/8_poll.d.ts} +11 -4
- package/esm/types/8_poll.d.ts.map +1 -0
- package/esm/types/{4_poll.js → 8_poll.js} +6 -3
- package/esm/types/{6_message.d.ts → 9_message.d.ts} +7 -14
- package/esm/types/9_message.d.ts.map +1 -0
- package/esm/types/{6_message.js → 9_message.js} +31 -25
- package/{script/types/7_callback_query.d.ts → esm/types/A_callback_query.d.ts} +2 -2
- package/esm/types/{7_callback_query.d.ts.map → A_callback_query.d.ts.map} +1 -1
- package/{script/types/7_chat_list_item.d.ts → esm/types/A_chat_list_item.d.ts} +2 -2
- package/esm/types/{7_chat_list_item.d.ts.map → A_chat_list_item.d.ts.map} +1 -1
- package/esm/types/{7_chat_list_item.js → A_chat_list_item.js} +1 -1
- package/{script/types/7_guest_query.d.ts → esm/types/A_guest_query.d.ts} +2 -2
- package/esm/types/{7_guest_query.d.ts.map → A_guest_query.d.ts.map} +1 -1
- package/esm/types/{7_message_list.d.ts → A_message_list.d.ts} +2 -2
- package/esm/types/{7_message_list.d.ts.map → A_message_list.d.ts.map} +1 -1
- package/esm/types/A_message_list.js +20 -0
- package/{script/types/7_saved_chat.d.ts → esm/types/A_saved_chat.d.ts} +2 -2
- package/esm/types/{7_saved_chat.d.ts.map → A_saved_chat.d.ts.map} +1 -1
- package/esm/types/{7_saved_chat.js → A_saved_chat.js} +1 -1
- package/esm/types/{7_topic.d.ts → A_topic.d.ts} +2 -2
- package/esm/types/{7_topic.d.ts.map → A_topic.d.ts.map} +1 -1
- package/{script/types/8_saved_chats.d.ts → esm/types/B_saved_chats.d.ts} +3 -3
- package/esm/types/{8_saved_chats.d.ts.map → B_saved_chats.d.ts.map} +1 -1
- package/esm/types/{8_saved_chats.js → B_saved_chats.js} +1 -1
- package/{script/types/8_update.d.ts → esm/types/B_update.d.ts} +6 -6
- package/esm/types/{8_update.d.ts.map → B_update.d.ts.map} +1 -1
- package/esm/types/B_update.js +20 -0
- package/esm/utilities/0_misc.d.ts +1 -0
- package/esm/utilities/0_misc.d.ts.map +1 -1
- package/esm/utilities/0_misc.js +1 -0
- package/package.json +1 -1
- package/script/3_types.d.ts +14 -11
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +14 -11
- package/script/client/0_params.d.ts +18 -8
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +32 -6
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +20 -0
- package/script/client/3_message_manager.d.ts +5 -1
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +272 -79
- package/script/client/4_context.d.ts +12 -2
- package/script/client/4_context.d.ts.map +1 -1
- package/script/client/4_context.js +32 -1
- package/script/client/4_inline_query_manager.d.ts +1 -1
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +2 -1
- package/script/client/4_poll_manager.d.ts +2 -0
- package/script/client/4_poll_manager.d.ts.map +1 -1
- package/script/client/4_poll_manager.js +1 -1
- package/script/client/6_client.d.ts +32 -6
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +41 -5
- package/script/client/6_client_dispatcher.d.ts +32 -6
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +36 -4
- package/script/types/0_dice.d.ts +1 -1
- package/script/types/0_dice.d.ts.map +1 -1
- package/script/types/0_message_counters.d.ts +1 -1
- package/script/types/0_message_counters.d.ts.map +1 -1
- package/script/types/0_upload_progress.d.ts +2 -0
- package/script/types/0_upload_progress.d.ts.map +1 -1
- package/script/types/0_voice_transcription.d.ts +1 -1
- package/script/types/0_voice_transcription.d.ts.map +1 -1
- package/script/types/1_chat_p.d.ts +2 -0
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +3 -2
- package/script/types/1_giveaway.d.ts +1 -1
- package/script/types/1_giveaway.d.ts.map +1 -1
- package/script/types/1_input_poll_media.d.ts +128 -0
- package/script/types/1_input_poll_media.d.ts.map +1 -0
- package/script/types/3_checklist_item.d.ts +1 -1
- package/script/types/3_checklist_item.d.ts.map +1 -1
- package/script/types/3_input_poll_option.d.ts +3 -0
- package/script/types/3_input_poll_option.d.ts.map +1 -1
- package/script/types/3_message_reactions.d.ts +1 -1
- package/script/types/3_message_reactions.d.ts.map +1 -1
- package/script/types/3_rich_text_component.d.ts +6 -7
- package/script/types/3_rich_text_component.d.ts.map +1 -1
- package/script/types/4_gift.d.ts +3 -3
- package/script/types/4_gift.d.ts.map +1 -1
- package/script/types/4_page_block.d.ts +2 -64
- package/script/types/4_page_block.d.ts.map +1 -1
- package/script/types/4_page_block.js +0 -51
- package/script/types/4_reply_to.d.ts +4 -0
- package/script/types/4_reply_to.d.ts.map +1 -1
- package/script/types/5_claimed_gift.d.ts +1 -1
- package/script/types/5_claimed_gift.d.ts.map +1 -1
- package/script/types/5_link_preview.d.ts +1 -1
- package/script/types/5_rich_text.d.ts +36 -0
- package/script/types/5_rich_text.d.ts.map +1 -0
- package/script/types/6_message_content.d.ts +14 -7
- package/script/types/6_message_content.d.ts.map +1 -1
- package/script/types/6_poll_media.d.ts +84 -0
- package/script/types/6_poll_media.d.ts.map +1 -0
- package/script/types/6_poll_media.js +105 -0
- package/script/types/7_inline_query_result.d.ts +2 -1
- package/script/types/7_inline_query_result.d.ts.map +1 -1
- package/script/types/7_inline_query_result.js +51 -12
- package/script/types/{3_poll_option.d.ts → 7_poll_option.d.ts} +11 -2
- package/script/types/7_poll_option.d.ts.map +1 -0
- package/script/types/{3_poll_option.js → 7_poll_option.js} +10 -5
- package/{esm/types/4_poll.d.ts → script/types/8_poll.d.ts} +11 -4
- package/script/types/8_poll.d.ts.map +1 -0
- package/script/types/{4_poll.js → 8_poll.js} +6 -3
- package/script/types/{6_message.d.ts → 9_message.d.ts} +7 -14
- package/script/types/9_message.d.ts.map +1 -0
- package/script/types/{6_message.js → 9_message.js} +31 -25
- package/{esm/types/7_callback_query.d.ts → script/types/A_callback_query.d.ts} +2 -2
- package/script/types/{7_callback_query.d.ts.map → A_callback_query.d.ts.map} +1 -1
- package/{esm/types/7_chat_list_item.d.ts → script/types/A_chat_list_item.d.ts} +2 -2
- package/script/types/{7_chat_list_item.d.ts.map → A_chat_list_item.d.ts.map} +1 -1
- package/script/types/{7_chat_list_item.js → A_chat_list_item.js} +2 -2
- package/{esm/types/7_guest_query.d.ts → script/types/A_guest_query.d.ts} +2 -2
- package/script/types/{7_guest_query.d.ts.map → A_guest_query.d.ts.map} +1 -1
- package/script/types/{7_message_list.d.ts → A_message_list.d.ts} +2 -2
- package/script/types/{7_message_list.d.ts.map → A_message_list.d.ts.map} +1 -1
- package/script/types/A_message_list.js +21 -0
- package/{esm/types/7_saved_chat.d.ts → script/types/A_saved_chat.d.ts} +2 -2
- package/script/types/{7_saved_chat.d.ts.map → A_saved_chat.d.ts.map} +1 -1
- package/script/types/{7_saved_chat.js → A_saved_chat.js} +2 -2
- package/script/types/{7_topic.d.ts → A_topic.d.ts} +2 -2
- package/script/types/{7_topic.d.ts.map → A_topic.d.ts.map} +1 -1
- package/{esm/types/8_saved_chats.d.ts → script/types/B_saved_chats.d.ts} +3 -3
- package/script/types/{8_saved_chats.d.ts.map → B_saved_chats.d.ts.map} +1 -1
- package/script/types/{8_saved_chats.js → B_saved_chats.js} +2 -2
- package/{esm/types/8_update.d.ts → script/types/B_update.d.ts} +6 -6
- package/script/types/{8_update.d.ts.map → B_update.d.ts.map} +1 -1
- package/script/types/B_update.js +21 -0
- package/script/utilities/0_misc.d.ts +1 -0
- package/script/utilities/0_misc.d.ts.map +1 -1
- package/script/utilities/0_misc.js +2 -1
- package/esm/types/3_poll_option.d.ts.map +0 -1
- package/esm/types/4_poll.d.ts.map +0 -1
- package/esm/types/6_message.d.ts.map +0 -1
- package/script/types/3_poll_option.d.ts.map +0 -1
- package/script/types/4_poll.d.ts.map +0 -1
- package/script/types/6_message.d.ts.map +0 -1
- /package/esm/types/{7_guest_query.js → 1_input_poll_media.js} +0 -0
- /package/esm/types/{7_message_list.js → 5_rich_text.js} +0 -0
- /package/esm/types/{7_callback_query.js → A_callback_query.js} +0 -0
- /package/esm/types/{8_update.js → A_guest_query.js} +0 -0
- /package/esm/types/{7_topic.js → A_topic.js} +0 -0
- /package/script/types/{7_guest_query.js → 1_input_poll_media.js} +0 -0
- /package/script/types/{7_message_list.js → 5_rich_text.js} +0 -0
- /package/script/types/{7_callback_query.js → A_callback_query.js} +0 -0
- /package/script/types/{8_update.js → A_guest_query.js} +0 -0
- /package/script/types/{7_topic.js → A_topic.js} +0 -0
|
@@ -111,6 +111,7 @@ export class FileManager {
|
|
|
111
111
|
id: String(fileId),
|
|
112
112
|
uploaded,
|
|
113
113
|
total: 0,
|
|
114
|
+
isUploaded: false,
|
|
114
115
|
},
|
|
115
116
|
});
|
|
116
117
|
}
|
|
@@ -121,6 +122,15 @@ export class FileManager {
|
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
await Promise.all(promises);
|
|
125
|
+
this.#c.handleUpdate({
|
|
126
|
+
type: "uploadProgress",
|
|
127
|
+
uploadProgress: {
|
|
128
|
+
id: String(fileId),
|
|
129
|
+
uploaded,
|
|
130
|
+
total: 0,
|
|
131
|
+
isUploaded: true,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
124
134
|
return { isSmall: part.isSmall, parts: part.totalParts, firstPart };
|
|
125
135
|
}
|
|
126
136
|
async #uploadBuffer(buffer, fileId, mustTrackProgress, chunkSize, poolSize, signal) {
|
|
@@ -159,6 +169,7 @@ export class FileManager {
|
|
|
159
169
|
id: String(fileId),
|
|
160
170
|
uploaded,
|
|
161
171
|
total: buffer.length,
|
|
172
|
+
isUploaded: false,
|
|
162
173
|
},
|
|
163
174
|
});
|
|
164
175
|
}
|
|
@@ -173,6 +184,15 @@ export class FileManager {
|
|
|
173
184
|
promises = [];
|
|
174
185
|
}
|
|
175
186
|
await Promise.all(promises);
|
|
187
|
+
this.#c.handleUpdate({
|
|
188
|
+
type: "uploadProgress",
|
|
189
|
+
uploadProgress: {
|
|
190
|
+
id: String(fileId),
|
|
191
|
+
uploaded,
|
|
192
|
+
total: 0,
|
|
193
|
+
isUploaded: true,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
176
196
|
return { isSmall: !isBig, parts: partCount, firstPart };
|
|
177
197
|
}
|
|
178
198
|
async #uploadPart(fileId, partCount, isBig, index, bytes, signal) {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { type InlineQueryResult, type InputChecklistItem, type InputMedia, type InputPollOption, type InputRichText, type MessageCounters, type MessageGetter, type MessageList, type MessageLivePhoto, type MessagePhoto, type PriceTag, type TextToTranslate, type TranslatedText, type VoiceTranscription } from "../3_types.js";
|
|
22
22
|
import { type ChatActionType, type FileSource, FileType, type ID, type Message, type MessageEntity, type ParseMode, type Reaction, type Update, type UsernameResolver } from "../3_types.js";
|
|
23
|
-
import type { AddReactionParams, DeleteMessagesParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageTextParams, ForwardMessagesParams, GetBlockedUsersParams, GetHistoryParams, GetMessageReactionsParams, GetSavedChatsParams, GetSavedMessagesParams, OpenMiniAppParams, PinMessageParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChatActionParams, SendChecklistParams as SendChecklistParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendRichTextDraftParams, SendRichTextParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetReactionsParams, StartBotParams, StopPollParams, SummarizeTextParams, TranslateTextParams, UnpinMessageParams, UnpinMessagesParams } from "./0_params.js";
|
|
23
|
+
import type { AddReactionParams, DeleteMessagesParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageRichTextParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageTextParams, ForwardMessagesParams, GetBlockedUsersParams, GetHistoryParams, GetMessageReactionsParams, GetSavedChatsParams, GetSavedMessagesParams, OpenMiniAppParams, PinMessageParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChatActionParams, SendChecklistParams as SendChecklistParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageDraftParams, SendMessageParams, SendPhotoParams, SendPollParams, SendRichTextDraftParams, SendRichTextParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetReactionsParams, StartBotParams, StopPollParams, SummarizeTextParams, TranslateTextParams, UnpinMessageParams, UnpinMessagesParams } from "./0_params.js";
|
|
24
24
|
import type { UpdateProcessor } from "./0_update_processor.js";
|
|
25
25
|
import type { C as C_ } from "./1_types.js";
|
|
26
26
|
import type { FileManager } from "./2_file_manager.js";
|
|
@@ -52,6 +52,7 @@ export declare class MessageManager implements UpdateProcessor<MessageManagerUpd
|
|
|
52
52
|
sendRichTextDraft(chatId: ID, draftId: number, richText: InputRichText, params?: SendRichTextDraftParams): Promise<void>;
|
|
53
53
|
sendMessage(chatId: ID, text: string, params?: SendMessageParams): Promise<import("../3_types.js").MessageText>;
|
|
54
54
|
sendRichText(chatId: ID, richText: InputRichText, params?: SendRichTextParams): Promise<import("../3_types.js").MessageRichText>;
|
|
55
|
+
static inputRichTextToInputRichMessage(richText: InputRichText): Api.InputRichMessage;
|
|
55
56
|
sendVenue(chatId: ID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<import("../3_types.js").MessageVenue>;
|
|
56
57
|
sendContact(chatId: ID, firstName: string, number: string, params?: SendContactParams): Promise<import("../3_types.js").MessageContact>;
|
|
57
58
|
sendDice(chatId: ID, params?: SendDiceParams): Promise<import("../3_types.js").MessageDice>;
|
|
@@ -75,11 +76,13 @@ export declare class MessageManager implements UpdateProcessor<MessageManagerUpd
|
|
|
75
76
|
editMessageReplyMarkup(chatId: ID, messageId: number, params?: EditMessageReplyMarkupParams): Promise<Message>;
|
|
76
77
|
editInlineMessageReplyMarkup(inlineMessageId: string, params?: EditMessageReplyMarkupParams): Promise<void>;
|
|
77
78
|
editMessageText(chatId: ID, messageId: number, text: string, params?: EditMessageTextParams): Promise<import("../3_types.js").MessageText>;
|
|
79
|
+
editMessageRichText(chatId: ID, messageId: number, richText: InputRichText, params?: EditMessageTextParams): Promise<import("../3_types.js").MessageRichText>;
|
|
78
80
|
editMessageCaption(chatId: ID, messageId: number, params?: EditMessageCaptionParams): Promise<Message>;
|
|
79
81
|
editInlineMessageText(inlineMessageId: string, text: string, params?: EditInlineMessageTextParams): Promise<void>;
|
|
80
82
|
editInlineMessageCaption(inlineMessageId: string, params?: EditInlineMessageCaptionParams): Promise<void>;
|
|
81
83
|
editMessageMedia(chatId: ID, messageId: number, media: InputMedia, params?: EditMessageMediaParams): Promise<Message>;
|
|
82
84
|
editInlineMessageMedia(inlineMessageId: string, media: InputMedia, params?: EditInlineMessageMediaParams): Promise<void>;
|
|
85
|
+
editInlineMessageRichText(inlineMessageId: string, richText: InputRichText, params?: EditInlineMessageRichTextParams): Promise<void>;
|
|
83
86
|
deleteMessages(chatId: ID, messageIds: number[], params?: DeleteMessagesParams): Promise<void>;
|
|
84
87
|
deleteScheduledMessages(chatId: ID, messageIds: number[]): Promise<void>;
|
|
85
88
|
deleteScheduledMessage(chatId: ID, messageId: number): Promise<void>;
|
|
@@ -130,6 +133,7 @@ export declare class MessageManager implements UpdateProcessor<MessageManagerUpd
|
|
|
130
133
|
translateText(toLanguage: string, text: TextToTranslate, params?: TranslateTextParams): Promise<TranslatedText>;
|
|
131
134
|
translateMessages(toLanguage: string, chatId: ID, messageIds: number[], params?: TranslateTextParams): Promise<TranslatedText[]>;
|
|
132
135
|
translateMessage(toLanguage: string, chatId: ID, messageId: number, params?: TranslateTextParams): Promise<TranslatedText>;
|
|
136
|
+
getRichText(chatId: ID, messageId: number): Promise<import("../3_types.js").RichText | null>;
|
|
133
137
|
}
|
|
134
138
|
export {};
|
|
135
139
|
//# sourceMappingURL=3_message_manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_message_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_message_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAoR,KAAK,iBAAiB,EAA+B,KAAK,kBAAkB,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"3_message_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_message_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAoR,KAAK,iBAAiB,EAA+B,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAiF,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAsD,KAAK,QAAQ,EAAoD,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxyB,OAAO,EAAqB,KAAK,cAAc,EAAqE,KAAK,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,KAAK,OAAO,EAAE,KAAK,aAAa,EAA2B,KAAK,SAAS,EAAE,KAAK,QAAQ,EAA4D,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtW,OAAO,KAAK,EAA6F,iBAAiB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,sB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M,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE;IAK7C,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM;IAYzC,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE;IAKpD,kBAAkB,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM;IAehD,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAKrH,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,mBAAmB;IAiBrF,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAKhI,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB;IAKhG,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM;CAiBhD"}
|
|
@@ -286,7 +286,7 @@ export class MessageManager {
|
|
|
286
286
|
async sendRichTextDraft(chatId, draftId, richText, params) {
|
|
287
287
|
this.#c.storage.assertBot("sendRichTextDraft");
|
|
288
288
|
const peer = await this.#c.getInputPeer(chatId);
|
|
289
|
-
const rich_message = MessageManager
|
|
289
|
+
const rich_message = MessageManager.inputRichTextToInputRichMessage(richText);
|
|
290
290
|
await this.#c.invoke({
|
|
291
291
|
_: "messages.setTyping",
|
|
292
292
|
peer,
|
|
@@ -367,7 +367,7 @@ export class MessageManager {
|
|
|
367
367
|
const effect = params?.effectId ? BigInt(params.effectId) : undefined;
|
|
368
368
|
const schedule_date = params?.sendAt;
|
|
369
369
|
const allow_paid_floodskip = params?.isPaidBroadcast ? true : undefined;
|
|
370
|
-
const rich_message = MessageManager
|
|
370
|
+
const rich_message = MessageManager.inputRichTextToInputRichMessage(richText);
|
|
371
371
|
const result = await this.#c.invoke({
|
|
372
372
|
_: "messages.sendMessage",
|
|
373
373
|
peer,
|
|
@@ -386,7 +386,7 @@ export class MessageManager {
|
|
|
386
386
|
const message_ = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
387
387
|
return assertMessageType(message_, "richText");
|
|
388
388
|
}
|
|
389
|
-
static
|
|
389
|
+
static inputRichTextToInputRichMessage(richText) {
|
|
390
390
|
let rich_message;
|
|
391
391
|
switch (richText.type) {
|
|
392
392
|
case "blocks": {
|
|
@@ -430,16 +430,30 @@ export class MessageManager {
|
|
|
430
430
|
}
|
|
431
431
|
async #constructReplyTo(params) {
|
|
432
432
|
const topMsgId = params?.messageThreadId;
|
|
433
|
+
const directMessagesTopicId = params?.directMessagesTopicId;
|
|
433
434
|
if (!params?.replyTo) {
|
|
434
435
|
if (topMsgId) {
|
|
435
436
|
return { _: "inputReplyToMessage", reply_to_msg_id: topMsgId, top_msg_id: topMsgId };
|
|
436
437
|
}
|
|
438
|
+
else if (directMessagesTopicId) {
|
|
439
|
+
return { _: "inputReplyToMonoForum", monoforum_peer_id: await this.#c.getInputPeer(directMessagesTopicId) };
|
|
440
|
+
}
|
|
437
441
|
else {
|
|
438
442
|
return undefined;
|
|
439
443
|
}
|
|
440
444
|
}
|
|
441
|
-
if (
|
|
442
|
-
return {
|
|
445
|
+
if (params.replyTo.type === "message") {
|
|
446
|
+
return {
|
|
447
|
+
_: "inputReplyToMessage",
|
|
448
|
+
reply_to_msg_id: params.replyTo.messageId,
|
|
449
|
+
top_msg_id: topMsgId,
|
|
450
|
+
quote_text: params.replyTo.quote?.text,
|
|
451
|
+
quote_entities: await Promise.all(params.replyTo.quote?.entities.map((v) => messageEntityToTlObject(v, this.#c.getPeer)) ?? []),
|
|
452
|
+
quote_offset: params.replyTo.quote?.offset,
|
|
453
|
+
monoforum_peer_id: directMessagesTopicId ? await this.#c.getInputPeer(directMessagesTopicId) : undefined,
|
|
454
|
+
poll_option: params.replyTo.pollOptionId ? encodeText(String(params.replyTo.pollOptionId)) : undefined,
|
|
455
|
+
todo_item_id: params.replyTo.checklistItemId,
|
|
456
|
+
};
|
|
443
457
|
}
|
|
444
458
|
else {
|
|
445
459
|
return { _: "inputReplyToStory", peer: await this.#c.getInputPeer(params.replyTo.chatId), story_id: params.replyTo.storyId };
|
|
@@ -718,28 +732,7 @@ export class MessageManager {
|
|
|
718
732
|
}
|
|
719
733
|
async #sendPhotoInner(chatId, photo, params) {
|
|
720
734
|
this.#checkParams(params);
|
|
721
|
-
|
|
722
|
-
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
723
|
-
const ttl_seconds = params && "selfDestruct" in params && params.selfDestruct !== undefined ? selfDestructOptionToInt(params.selfDestruct) : undefined;
|
|
724
|
-
let video;
|
|
725
|
-
if (params?.video) {
|
|
726
|
-
video = await this.#uploadVideo(params.video);
|
|
727
|
-
}
|
|
728
|
-
if (typeof photo === "string") {
|
|
729
|
-
const fileId = this.resolveFileId(photo, [FileType.Photo, FileType.ProfilePhoto]);
|
|
730
|
-
if (fileId !== null) {
|
|
731
|
-
media = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds, live_photo: video !== undefined ? true : undefined, video };
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
if (media === null) {
|
|
735
|
-
if (typeof photo === "string" && isHttpUrl(photo)) {
|
|
736
|
-
media = { _: "inputMediaPhotoExternal", url: photo, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined };
|
|
737
|
-
}
|
|
738
|
-
else {
|
|
739
|
-
const file = await this.#c.fileManager.upload(photo, params, checkPhotoName(params), false);
|
|
740
|
-
media = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined, live_photo: video !== undefined ? true : undefined, video };
|
|
741
|
-
}
|
|
742
|
-
}
|
|
735
|
+
const media = await this.#uploadPhoto(photo, params);
|
|
743
736
|
const message = await this.#sendMedia(chatId, media, params);
|
|
744
737
|
return assertMessageType(message, params?.video ? "livePhoto" : "photo");
|
|
745
738
|
}
|
|
@@ -805,8 +798,8 @@ export class MessageManager {
|
|
|
805
798
|
if (!question) {
|
|
806
799
|
throw new Error("Question must not be empty.");
|
|
807
800
|
}
|
|
808
|
-
if (!Array.isArray(options) || options.length <
|
|
809
|
-
throw new Error("There must be at least
|
|
801
|
+
if (!Array.isArray(options) || options.length < 1) {
|
|
802
|
+
throw new Error("There must be at least one option.");
|
|
810
803
|
}
|
|
811
804
|
const peer = await this.#c.getInputPeer(chatId);
|
|
812
805
|
const randomId = getRandomId();
|
|
@@ -818,15 +811,47 @@ export class MessageManager {
|
|
|
818
811
|
const parseResult = explanation !== undefined ? this.parseText(explanation, { parseMode: params?.explanationParseMode, entities: params?.explanationEntities }) : undefined;
|
|
819
812
|
const solution = parseResult?.[0];
|
|
820
813
|
const solutionEntities = parseResult?.[1];
|
|
814
|
+
const mediaMap = new Map();
|
|
815
|
+
for (const [i, option] of options.entries()) {
|
|
816
|
+
if (option.media) {
|
|
817
|
+
mediaMap.set(i, await this.#resolvePollMedia(peer, option.media));
|
|
818
|
+
}
|
|
819
|
+
}
|
|
821
820
|
const answers = options.map((v, i) => {
|
|
822
821
|
const text = v.text;
|
|
823
822
|
const entities = v.entities;
|
|
824
823
|
const parseResult = this.parseText(text, { parseMode: v.parseMode, entities });
|
|
825
|
-
return ({ _: "
|
|
824
|
+
return ({ _: "inputPollAnswer", text: { _: "textWithEntities", text: parseResult[0], entities: parseResult[1] ?? [] }, media: mediaMap.get(i) });
|
|
826
825
|
});
|
|
827
826
|
const questionParseResult = this.parseText(question, { parseMode: params?.questionParseMode, entities: params?.questionEntities });
|
|
828
|
-
const poll = {
|
|
829
|
-
|
|
827
|
+
const poll = {
|
|
828
|
+
_: "poll",
|
|
829
|
+
id: getRandomId(),
|
|
830
|
+
answers,
|
|
831
|
+
question: { _: "textWithEntities", text: questionParseResult[0], entities: questionParseResult[1] ?? [] },
|
|
832
|
+
closed: params?.isClosed ? true : undefined,
|
|
833
|
+
close_date: params?.closeDate,
|
|
834
|
+
close_period: params?.openPeriod ? params.openPeriod : undefined,
|
|
835
|
+
multiple_choice: params?.isMultipleAnswersAllowed ? true : undefined,
|
|
836
|
+
public_voters: params?.isAnonymous === false ? true : undefined,
|
|
837
|
+
quiz: params?.type === "quiz" ? true : undefined,
|
|
838
|
+
hash: 0n,
|
|
839
|
+
revoting_disabled: params?.isRevotingAllowed === false ? true : undefined,
|
|
840
|
+
shuffle_answers: params?.isShuffled ? true : undefined,
|
|
841
|
+
hide_results_until_close: params?.isResultHidden ? true : undefined,
|
|
842
|
+
open_answers: params?.isAddingOptionsAllowed ? true : undefined,
|
|
843
|
+
countries_iso2: params?.countries,
|
|
844
|
+
subscribers_only: params?.isSubscriberOnly || undefined,
|
|
845
|
+
};
|
|
846
|
+
const media = {
|
|
847
|
+
_: "inputMediaPoll",
|
|
848
|
+
poll,
|
|
849
|
+
correct_answers: params?.correctOptionIndexes,
|
|
850
|
+
solution,
|
|
851
|
+
solution_entities: solutionEntities,
|
|
852
|
+
solution_media: params?.explanationMedia ? await this.#resolvePollMedia(peer, params.explanationMedia) : undefined,
|
|
853
|
+
attached_media: params?.media ? await this.#resolvePollMedia(peer, params.media) : undefined,
|
|
854
|
+
};
|
|
830
855
|
const description = params?.description;
|
|
831
856
|
const parseResult2 = description !== undefined ? this.parseText(description, { parseMode: params?.descriptionParseMode, entities: params?.descriptionEntities }) : undefined;
|
|
832
857
|
const caption = parseResult2?.[0];
|
|
@@ -850,6 +875,39 @@ export class MessageManager {
|
|
|
850
875
|
const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
851
876
|
return assertMessageType(message, "poll");
|
|
852
877
|
}
|
|
878
|
+
async #resolvePollMedia(peer, media) {
|
|
879
|
+
switch (media.type) {
|
|
880
|
+
case "photo":
|
|
881
|
+
return await this.#getInputMediaPhoto(peer, media.photo, media);
|
|
882
|
+
case "video":
|
|
883
|
+
return this.#getInputMediaDocument(await this.#uploadVideo(media.video, media));
|
|
884
|
+
case "animation":
|
|
885
|
+
return this.#getInputMediaDocument(await this.#uploadAnimation(media.animation, media));
|
|
886
|
+
case "sticker":
|
|
887
|
+
return this.#getInputMediaDocument(await this.#uploadSticker(media.sticker, media));
|
|
888
|
+
case "livePhoto":
|
|
889
|
+
return await this.#getInputMediaPhoto(peer, media.photo, media);
|
|
890
|
+
case "location":
|
|
891
|
+
return { _: "inputMediaGeoPoint", geo_point: { _: "inputGeoPoint", lat: media.latitude, long: media.longitude, accuracy_radius: media.horizontalAccuracy } };
|
|
892
|
+
case "venue":
|
|
893
|
+
return {
|
|
894
|
+
_: "inputMediaVenue",
|
|
895
|
+
address: media.address,
|
|
896
|
+
geo_point: {
|
|
897
|
+
_: "inputGeoPoint",
|
|
898
|
+
lat: media.latitude,
|
|
899
|
+
long: media.longitude,
|
|
900
|
+
},
|
|
901
|
+
provider: "foursquare",
|
|
902
|
+
title: media.title,
|
|
903
|
+
venue_id: media.foursquareId ?? "",
|
|
904
|
+
venue_type: media.foursquareType ?? "",
|
|
905
|
+
};
|
|
906
|
+
case "link":
|
|
907
|
+
return { _: "inputMediaWebPage", url: media.url };
|
|
908
|
+
}
|
|
909
|
+
unreachable();
|
|
910
|
+
}
|
|
853
911
|
async sendChecklist(chatId, title, items, params) {
|
|
854
912
|
this.#checkParams(params);
|
|
855
913
|
title = title?.trim();
|
|
@@ -953,6 +1011,28 @@ export class MessageManager {
|
|
|
953
1011
|
const message_ = (await this.updatesToMessages(chatId, result))[0];
|
|
954
1012
|
return assertMessageType(message_, "text");
|
|
955
1013
|
}
|
|
1014
|
+
async editMessageRichText(chatId, messageId, richText, params) {
|
|
1015
|
+
this.#checkParams(params);
|
|
1016
|
+
{
|
|
1017
|
+
const message = await this.getMessage(chatId, messageId);
|
|
1018
|
+
if (!message) {
|
|
1019
|
+
throw new InputError("Message not found.");
|
|
1020
|
+
}
|
|
1021
|
+
if (message.type !== "link" && message.type !== "richText") {
|
|
1022
|
+
throw new InputError("The referenced message is not a rich text message.");
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
const rich_message = MessageManager.inputRichTextToInputRichMessage(richText);
|
|
1026
|
+
const result = await this.#c.invoke({
|
|
1027
|
+
_: "messages.editMessage",
|
|
1028
|
+
id: checkMessageId(messageId),
|
|
1029
|
+
peer: await this.#c.getInputPeer(chatId),
|
|
1030
|
+
rich_message,
|
|
1031
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
1032
|
+
}, { businessConnectionId: params?.businessConnectionId });
|
|
1033
|
+
const message_ = (await this.updatesToMessages(chatId, result))[0];
|
|
1034
|
+
return assertMessageType(message_, "richText");
|
|
1035
|
+
}
|
|
956
1036
|
static #CAPTIONABLE_MESSAGE_TYPES = ["photo", "document", "video", "animation", "voice", "audio", "video"];
|
|
957
1037
|
async editMessageCaption(chatId, messageId, params) {
|
|
958
1038
|
let canHaveCaption = false;
|
|
@@ -1047,52 +1127,49 @@ export class MessageManager {
|
|
|
1047
1127
|
return media_;
|
|
1048
1128
|
}
|
|
1049
1129
|
async #resolveInputMedia(media) {
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
media_ = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
if (media_ === null) {
|
|
1075
|
-
if (typeof media.photo === "string" && isHttpUrl(media.photo)) {
|
|
1076
|
-
media_ = { _: "inputMediaPhotoExternal", url: media.photo, spoiler };
|
|
1130
|
+
switch (media.type) {
|
|
1131
|
+
case "animation":
|
|
1132
|
+
return await this.#resolveInputMediaInner(media.animation, media, FileType.Animation, [
|
|
1133
|
+
{ _: "documentAttributeAnimated" },
|
|
1134
|
+
{ _: "documentAttributeVideo", supports_streaming: true, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
1135
|
+
]);
|
|
1136
|
+
case "audio":
|
|
1137
|
+
return await this.#resolveInputMediaInner(media.audio, media, FileType.Audio, [
|
|
1138
|
+
{ _: "documentAttributeAudio", duration: media?.duration ?? 0, performer: media?.performer, title: media?.title },
|
|
1139
|
+
]);
|
|
1140
|
+
case "document":
|
|
1141
|
+
return await this.#resolveInputMediaInner(media.document, media, FileType.Document, []);
|
|
1142
|
+
case "photo": {
|
|
1143
|
+
let media_ = null;
|
|
1144
|
+
const spoiler = media.hasSpoiler ? true : undefined;
|
|
1145
|
+
const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? selfDestructOptionToInt(media.selfDestruct) : undefined;
|
|
1146
|
+
if (typeof media.photo === "string") {
|
|
1147
|
+
const fileId = this.resolveFileId(media.photo, [FileType.Photo, FileType.ProfilePhoto]);
|
|
1148
|
+
if (fileId !== null) {
|
|
1149
|
+
media_ = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
|
|
1150
|
+
}
|
|
1077
1151
|
}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1152
|
+
if (media_ === null) {
|
|
1153
|
+
if (typeof media.photo === "string" && isHttpUrl(media.photo)) {
|
|
1154
|
+
media_ = { _: "inputMediaPhotoExternal", url: media.photo, spoiler };
|
|
1155
|
+
}
|
|
1156
|
+
else {
|
|
1157
|
+
const file = await this.#c.fileManager.upload(media.photo, media, null, false);
|
|
1158
|
+
media_ = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds };
|
|
1159
|
+
}
|
|
1081
1160
|
}
|
|
1161
|
+
return media_;
|
|
1162
|
+
}
|
|
1163
|
+
case "video": {
|
|
1164
|
+
const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? selfDestructOptionToInt(media.selfDestruct) : undefined;
|
|
1165
|
+
const media_ = await this.#resolveInputMediaInner(media.video, media, FileType.Video, [
|
|
1166
|
+
{ _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming ? true : undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
1167
|
+
]);
|
|
1168
|
+
media_.ttl_seconds = ttl_seconds;
|
|
1169
|
+
return media_;
|
|
1082
1170
|
}
|
|
1083
|
-
return media_;
|
|
1084
|
-
}
|
|
1085
|
-
else if ("video" in media) {
|
|
1086
|
-
const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? selfDestructOptionToInt(media.selfDestruct) : undefined;
|
|
1087
|
-
const media_ = await this.#resolveInputMediaInner(media.video, media, FileType.Video, [
|
|
1088
|
-
{ _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming ? true : undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
|
|
1089
|
-
]);
|
|
1090
|
-
media_.ttl_seconds = ttl_seconds;
|
|
1091
|
-
return media_;
|
|
1092
|
-
}
|
|
1093
|
-
else {
|
|
1094
|
-
unreachable();
|
|
1095
1171
|
}
|
|
1172
|
+
unreachable();
|
|
1096
1173
|
}
|
|
1097
1174
|
async #resolveInputMediaUpload(media, businessConnectionId) {
|
|
1098
1175
|
const inputMedia = await this.#resolveInputMedia(media);
|
|
@@ -1128,14 +1205,104 @@ export class MessageManager {
|
|
|
1128
1205
|
}
|
|
1129
1206
|
return inputMedia;
|
|
1130
1207
|
}
|
|
1131
|
-
async #
|
|
1132
|
-
const result = await this.#
|
|
1208
|
+
async #getInputMediaPhoto(peer, photo, params) {
|
|
1209
|
+
const result = await this.#uploadPhoto(photo, params);
|
|
1210
|
+
if (Api.is("inputMediaPhoto", result)) {
|
|
1211
|
+
return result;
|
|
1212
|
+
}
|
|
1213
|
+
const messageMediaPhoto = Api.as("messageMediaPhoto", await this.#c.invoke({ _: "messages.uploadMedia", peer, media: result, business_connection_id: params?.businessConnectionId }));
|
|
1214
|
+
const photo_ = Api.as("photo", messageMediaPhoto.photo);
|
|
1215
|
+
return {
|
|
1216
|
+
_: "inputMediaPhoto",
|
|
1217
|
+
id: { _: "inputPhoto", id: photo_.id, access_hash: photo_.access_hash, file_reference: photo_.file_reference },
|
|
1218
|
+
live_photo: !!messageMediaPhoto.video || undefined,
|
|
1219
|
+
video: Api.is("document", messageMediaPhoto.video) ? { _: "inputDocument", id: messageMediaPhoto.video.id, access_hash: messageMediaPhoto.video.access_hash, file_reference: messageMediaPhoto.video.file_reference } : undefined,
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
async #uploadPhoto(photo, params) {
|
|
1223
|
+
let media = null;
|
|
1224
|
+
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
1225
|
+
const ttl_seconds = params && "selfDestruct" in params && params.selfDestruct !== undefined ? selfDestructOptionToInt(params.selfDestruct) : undefined;
|
|
1226
|
+
let video;
|
|
1227
|
+
if (params?.video) {
|
|
1228
|
+
video = await this.#uploadVideo(params.video);
|
|
1229
|
+
}
|
|
1230
|
+
if (typeof photo === "string") {
|
|
1231
|
+
const fileId = this.resolveFileId(photo, [FileType.Photo, FileType.ProfilePhoto]);
|
|
1232
|
+
if (fileId !== null) {
|
|
1233
|
+
media = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds, live_photo: video !== undefined ? true : undefined, video };
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
if (media === null) {
|
|
1237
|
+
if (typeof photo === "string" && isHttpUrl(photo)) {
|
|
1238
|
+
media = { _: "inputMediaPhotoExternal", url: photo, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined };
|
|
1239
|
+
}
|
|
1240
|
+
else {
|
|
1241
|
+
const file = await this.#c.fileManager.upload(photo, params, checkPhotoName(params), false);
|
|
1242
|
+
media = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? selfDestructOptionToInt(params.selfDestruct) : undefined, live_photo: video !== undefined ? true : undefined, video };
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
return media;
|
|
1246
|
+
}
|
|
1247
|
+
async #uploadDocument(document, attributes, mimeType, params, checkName, allowStream) {
|
|
1248
|
+
const result = await this.#c.fileManager.upload(document, params, checkName, allowStream);
|
|
1133
1249
|
const uploadedMedia = await this.#c.invoke({
|
|
1134
1250
|
_: "messages.uploadMedia",
|
|
1135
1251
|
peer: { _: "inputPeerSelf" },
|
|
1136
|
-
media: { _: "inputMediaUploadedDocument", file: result, attributes
|
|
1252
|
+
media: { _: "inputMediaUploadedDocument", file: result, attributes, mime_type: mimeType, spoiler: params?.hasSpoiler || undefined },
|
|
1137
1253
|
});
|
|
1138
|
-
|
|
1254
|
+
return Api.as("messageMediaDocument", uploadedMedia);
|
|
1255
|
+
}
|
|
1256
|
+
#getInputMediaDocument(input) {
|
|
1257
|
+
return {
|
|
1258
|
+
_: "inputMediaDocument",
|
|
1259
|
+
id: {
|
|
1260
|
+
...input,
|
|
1261
|
+
_: "inputDocument",
|
|
1262
|
+
},
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
async #uploadAnimation(video, params) {
|
|
1266
|
+
if (typeof video === "string") {
|
|
1267
|
+
const fileId = this.resolveFileId(video, [FileType.Animation]);
|
|
1268
|
+
if (fileId !== null) {
|
|
1269
|
+
return { ...fileId, _: "inputDocument" };
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
const messageMediaDocument = await this.#uploadDocument(video, [{ _: "documentAttributeVideo", duration: params?.duration ?? 0, w: params?.width ?? 0, h: params?.height ?? 0 }, { _: "documentAttributeAnimated" }], "video/mp4", params);
|
|
1273
|
+
const document = Api.as("document", Api.as("messageMediaDocument", messageMediaDocument).document);
|
|
1274
|
+
return {
|
|
1275
|
+
_: "inputDocument",
|
|
1276
|
+
id: document.id,
|
|
1277
|
+
access_hash: document.access_hash,
|
|
1278
|
+
file_reference: document.file_reference,
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
async #uploadSticker(video, params) {
|
|
1282
|
+
if (typeof video === "string") {
|
|
1283
|
+
const fileId = this.resolveFileId(video, [FileType.Sticker]);
|
|
1284
|
+
if (fileId !== null) {
|
|
1285
|
+
return { ...fileId, _: "inputDocument" };
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
const messageMediaDocument = await this.#uploadDocument(video, [{ _: "documentAttributeSticker", alt: params?.emoji ?? "", stickerset: { _: "inputStickerSetEmpty" } }], "video/mp4", params);
|
|
1289
|
+
const document = Api.as("document", Api.as("messageMediaDocument", messageMediaDocument).document);
|
|
1290
|
+
return {
|
|
1291
|
+
_: "inputDocument",
|
|
1292
|
+
id: document.id,
|
|
1293
|
+
access_hash: document.access_hash,
|
|
1294
|
+
file_reference: document.file_reference,
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
async #uploadVideo(video, params) {
|
|
1298
|
+
if (typeof video === "string") {
|
|
1299
|
+
const fileId = this.resolveFileId(video, [FileType.Video]);
|
|
1300
|
+
if (fileId !== null) {
|
|
1301
|
+
return { ...fileId, _: "inputDocument" };
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
const messageMediaDocument = await this.#uploadDocument(video, [{ _: "documentAttributeVideo", duration: 0, w: 0, h: 0 }], "video/mp4", params);
|
|
1305
|
+
const document = Api.as("document", Api.as("messageMediaDocument", messageMediaDocument).document);
|
|
1139
1306
|
return {
|
|
1140
1307
|
_: "inputDocument",
|
|
1141
1308
|
id: document.id,
|
|
@@ -1176,6 +1343,17 @@ export class MessageManager {
|
|
|
1176
1343
|
reply_markup: await this.#constructReplyMarkup(params),
|
|
1177
1344
|
}, { dc: getDc(id.dc_id) });
|
|
1178
1345
|
}
|
|
1346
|
+
async editInlineMessageRichText(inlineMessageId, richText, params) {
|
|
1347
|
+
this.#c.storage.assertBot("editInlineMessageRichText");
|
|
1348
|
+
const id = await deserializeInlineMessageId(inlineMessageId);
|
|
1349
|
+
const rich_message = MessageManager.inputRichTextToInputRichMessage(richText);
|
|
1350
|
+
await this.#c.invoke({
|
|
1351
|
+
_: "messages.editInlineBotMessage",
|
|
1352
|
+
id,
|
|
1353
|
+
rich_message,
|
|
1354
|
+
reply_markup: await this.#constructReplyMarkup(params),
|
|
1355
|
+
}, { dc: getDc(id.dc_id) });
|
|
1356
|
+
}
|
|
1179
1357
|
async deleteMessages(chatId, messageIds, params) {
|
|
1180
1358
|
checkArray(messageIds, checkMessageId);
|
|
1181
1359
|
const peer = await this.#c.getInputPeer(chatId);
|
|
@@ -1911,7 +2089,7 @@ export class MessageManager {
|
|
|
1911
2089
|
return constructSummarizedText(result);
|
|
1912
2090
|
}
|
|
1913
2091
|
async answerGuestQuery(id, result_) {
|
|
1914
|
-
const result = await inlineQueryResultToTlObject(result_, this.parseText.bind(this), this.usernameResolver.bind(this));
|
|
2092
|
+
const result = await inlineQueryResultToTlObject(result_, this.parseText.bind(this), this.usernameResolver.bind(this), MessageManager.inputRichTextToInputRichMessage);
|
|
1915
2093
|
const result__ = await this.#c.invoke({ _: "messages.setBotGuestChatResult", query_id: BigInt(id), result });
|
|
1916
2094
|
return base64EncodeUrlSafe(Api.serializeObject(result__));
|
|
1917
2095
|
}
|
|
@@ -1978,4 +2156,19 @@ export class MessageManager {
|
|
|
1978
2156
|
this.#c.storage.assertUser("translateMessage");
|
|
1979
2157
|
return (await this.#translateMessages(toLanguage, chatId, [messageId], params))[0];
|
|
1980
2158
|
}
|
|
2159
|
+
async getRichText(chatId, messageId) {
|
|
2160
|
+
this.#c.storage.assertUser("getRichText");
|
|
2161
|
+
const peer = await this.#c.getInputPeer(chatId);
|
|
2162
|
+
const id = messageId;
|
|
2163
|
+
const result = await this.#c.invoke({ _: "messages.getRichMessage", peer, id });
|
|
2164
|
+
if (!Api.is("messages.messages", result)) {
|
|
2165
|
+
unreachable();
|
|
2166
|
+
}
|
|
2167
|
+
const message_ = result.messages[0];
|
|
2168
|
+
if (!message_) {
|
|
2169
|
+
return null;
|
|
2170
|
+
}
|
|
2171
|
+
const message = assertMessageType(await this.constructMessage(message_, false), "richText");
|
|
2172
|
+
return message.richText;
|
|
2173
|
+
}
|
|
1981
2174
|
}
|