@mtkruto/node 0.109.0 → 0.110.1
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/client/0_client_abstract.d.ts +3 -3
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +6 -6
- package/esm/client/0_html.js +4 -4
- package/esm/client/0_params.d.ts +20 -19
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +1 -1
- package/esm/client/1_types.d.ts +1 -1
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +6 -6
- package/esm/client/2_client_encrypted.js +2 -2
- package/esm/client/2_context.js +19 -19
- package/esm/client/2_file_manager.js +5 -5
- package/esm/client/2_network_statistics_manager.d.ts +1 -1
- package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +3 -3
- package/esm/client/2_sign_in.js +6 -6
- package/esm/client/2_update_manager.js +2 -2
- package/esm/client/3_message_manager.js +38 -38
- package/esm/client/3_video_chat_manager.js +3 -3
- package/esm/client/4_callback_query_manager.js +1 -1
- package/esm/client/4_chat_list_manager.js +1 -1
- package/esm/client/4_chat_manager.js +6 -6
- package/esm/client/4_gift_manager.js +1 -1
- package/esm/client/4_story_manager.js +1 -1
- package/esm/client/5_client.d.ts +2 -2
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +33 -33
- package/esm/connection/0_connection.d.ts +2 -2
- package/esm/connection/0_connection.d.ts.map +1 -1
- package/esm/connection/1_connection_tcp.node.d.ts +1 -1
- package/esm/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/esm/connection/1_connection_tcp.node.js +4 -4
- package/esm/connection/1_connection_web_socket.d.ts +1 -1
- package/esm/connection/1_connection_web_socket.d.ts.map +1 -1
- package/esm/connection/1_connection_web_socket.js +3 -3
- package/esm/session/1_session.d.ts +4 -4
- package/esm/session/1_session.d.ts.map +1 -1
- package/esm/session/1_session.js +21 -21
- package/esm/session/2_session_encrypted.js +5 -5
- package/esm/session/2_session_plain.js +2 -2
- package/esm/transport/1_transport_provider.d.ts +2 -2
- package/esm/transport/1_transport_provider.d.ts.map +1 -1
- package/esm/transport/1_transport_provider.js +2 -2
- package/esm/transport/2_transport_provider_tcp.js +1 -1
- package/esm/transport/2_transport_provider_web_socket.js +3 -3
- package/esm/types/0_bot_token_check_result.d.ts +2 -2
- package/esm/types/0_bot_token_check_result.d.ts.map +1 -1
- package/esm/types/0_code_check_result.d.ts +3 -3
- package/esm/types/0_code_check_result.d.ts.map +1 -1
- package/esm/types/0_password_check_result.d.ts +3 -3
- package/esm/types/0_password_check_result.d.ts.map +1 -1
- package/esm/types/0_video_chat.d.ts +1 -1
- package/esm/types/0_video_chat.d.ts.map +1 -1
- package/esm/types/0_video_chat.js +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/0_voice_transcription.js +1 -1
- package/esm/types/1_chat_p.d.ts +1 -1
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +1 -1
- package/esm/types/1_input_story_content.d.ts +1 -1
- package/esm/types/1_input_story_content.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.d.ts +7 -7
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +12 -12
- package/esm/types/1_message_reaction.d.ts +1 -1
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +1 -1
- package/esm/types/2_message_reaction_list_item.d.ts +2 -2
- package/esm/types/2_message_reaction_list_item.d.ts.map +1 -1
- package/esm/types/2_message_reaction_list_item.js +4 -4
- package/esm/types/2_reply_markup.d.ts +5 -5
- package/esm/types/2_reply_markup.d.ts.map +1 -1
- package/esm/types/2_reply_markup.js +7 -7
- package/esm/types/2_user.d.ts +1 -1
- package/esm/types/2_user.d.ts.map +1 -1
- package/esm/types/2_user.js +2 -2
- package/esm/types/3_chat_settings.d.ts +9 -9
- package/esm/types/3_chat_settings.d.ts.map +1 -1
- package/esm/types/3_chat_settings.js +9 -9
- package/esm/types/3_story.d.ts +3 -3
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/3_story.js +4 -4
- 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_claimed_gift.js +2 -2
- package/esm/types/5_link_preview.d.ts +1 -1
- package/esm/types/5_link_preview.d.ts.map +1 -1
- package/esm/types/6_message.d.ts +2 -2
- package/esm/types/6_message.d.ts.map +1 -1
- package/esm/types/6_message.js +2 -2
- package/esm/types/7_inline_query_result.d.ts +1 -1
- package/esm/types/7_inline_query_result.d.ts.map +1 -1
- package/esm/types/7_inline_query_result.js +1 -1
- package/esm/utilities/0_part_stream.d.ts +1 -1
- package/esm/utilities/0_part_stream.d.ts.map +1 -1
- package/esm/utilities/0_part_stream.js +2 -2
- package/package.json +1 -1
- package/script/client/0_client_abstract.d.ts +3 -3
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +6 -6
- package/script/client/0_html.js +4 -4
- package/script/client/0_params.d.ts +20 -19
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/1_client_plain.js +1 -1
- package/script/client/1_types.d.ts +1 -1
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.js +6 -6
- package/script/client/2_client_encrypted.js +2 -2
- package/script/client/2_context.js +19 -19
- package/script/client/2_file_manager.js +5 -5
- package/script/client/2_network_statistics_manager.d.ts +1 -1
- package/script/client/2_network_statistics_manager.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +3 -3
- package/script/client/2_sign_in.js +6 -6
- package/script/client/2_update_manager.js +2 -2
- package/script/client/3_message_manager.js +38 -38
- package/script/client/3_video_chat_manager.js +3 -3
- package/script/client/4_callback_query_manager.js +1 -1
- package/script/client/4_chat_list_manager.js +1 -1
- package/script/client/4_chat_manager.js +6 -6
- package/script/client/4_gift_manager.js +1 -1
- package/script/client/4_story_manager.js +1 -1
- package/script/client/5_client.d.ts +2 -2
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +33 -33
- package/script/connection/0_connection.d.ts +2 -2
- package/script/connection/0_connection.d.ts.map +1 -1
- package/script/connection/1_connection_tcp.node.d.ts +1 -1
- package/script/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/script/connection/1_connection_tcp.node.js +4 -4
- package/script/connection/1_connection_web_socket.d.ts +1 -1
- package/script/connection/1_connection_web_socket.d.ts.map +1 -1
- package/script/connection/1_connection_web_socket.js +3 -3
- package/script/session/1_session.d.ts +4 -4
- package/script/session/1_session.d.ts.map +1 -1
- package/script/session/1_session.js +21 -21
- package/script/session/2_session_encrypted.js +5 -5
- package/script/session/2_session_plain.js +2 -2
- package/script/transport/1_transport_provider.d.ts +2 -2
- package/script/transport/1_transport_provider.d.ts.map +1 -1
- package/script/transport/1_transport_provider.js +2 -2
- package/script/transport/2_transport_provider_tcp.js +1 -1
- package/script/transport/2_transport_provider_web_socket.js +3 -3
- package/script/types/0_bot_token_check_result.d.ts +2 -2
- package/script/types/0_bot_token_check_result.d.ts.map +1 -1
- package/script/types/0_code_check_result.d.ts +3 -3
- package/script/types/0_code_check_result.d.ts.map +1 -1
- package/script/types/0_password_check_result.d.ts +3 -3
- package/script/types/0_password_check_result.d.ts.map +1 -1
- package/script/types/0_video_chat.d.ts +1 -1
- package/script/types/0_video_chat.d.ts.map +1 -1
- package/script/types/0_video_chat.js +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/0_voice_transcription.js +1 -1
- package/script/types/1_chat_p.d.ts +1 -1
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +1 -1
- package/script/types/1_input_story_content.d.ts +1 -1
- package/script/types/1_input_story_content.d.ts.map +1 -1
- package/script/types/1_keyboard_button.d.ts +7 -7
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +12 -12
- package/script/types/1_message_reaction.d.ts +1 -1
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +1 -1
- package/script/types/2_message_reaction_list_item.d.ts +2 -2
- package/script/types/2_message_reaction_list_item.d.ts.map +1 -1
- package/script/types/2_message_reaction_list_item.js +4 -4
- package/script/types/2_reply_markup.d.ts +5 -5
- package/script/types/2_reply_markup.d.ts.map +1 -1
- package/script/types/2_reply_markup.js +7 -7
- package/script/types/2_user.d.ts +1 -1
- package/script/types/2_user.d.ts.map +1 -1
- package/script/types/2_user.js +2 -2
- package/script/types/3_chat_settings.d.ts +9 -9
- package/script/types/3_chat_settings.d.ts.map +1 -1
- package/script/types/3_chat_settings.js +9 -9
- package/script/types/3_story.d.ts +3 -3
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/3_story.js +4 -4
- 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_claimed_gift.js +2 -2
- package/script/types/5_link_preview.d.ts +1 -1
- package/script/types/5_link_preview.d.ts.map +1 -1
- package/script/types/6_message.d.ts +2 -2
- package/script/types/6_message.d.ts.map +1 -1
- package/script/types/6_message.js +2 -2
- package/script/types/7_inline_query_result.d.ts +1 -1
- package/script/types/7_inline_query_result.d.ts.map +1 -1
- package/script/types/7_inline_query_result.js +1 -1
- package/script/utilities/0_part_stream.d.ts +1 -1
- package/script/utilities/0_part_stream.d.ts.map +1 -1
- package/script/utilities/0_part_stream.js +2 -2
|
@@ -110,7 +110,7 @@ class Context {
|
|
|
110
110
|
}
|
|
111
111
|
(0, _0_deps_js_1.unreachable)();
|
|
112
112
|
}
|
|
113
|
-
#getReplyTo = (
|
|
113
|
+
#getReplyTo = (isQuoted, chatId, messageId) => {
|
|
114
114
|
if ("story" in this.update) {
|
|
115
115
|
return { replyTo: { chatId: this.update.story.chat.id, storyId: this.update.story.id } };
|
|
116
116
|
}
|
|
@@ -125,7 +125,7 @@ class Context {
|
|
|
125
125
|
messageThreadId = this.update.scheduledMessage.threadId;
|
|
126
126
|
}
|
|
127
127
|
const isPrivate = chatId > 0;
|
|
128
|
-
const shouldQuote =
|
|
128
|
+
const shouldQuote = isQuoted === undefined ? !isPrivate : isQuoted;
|
|
129
129
|
return { messageThreadId, replyTo: shouldQuote ? { messageId } : undefined };
|
|
130
130
|
};
|
|
131
131
|
get chat() {
|
|
@@ -153,7 +153,7 @@ class Context {
|
|
|
153
153
|
*/
|
|
154
154
|
async reply(text, params) {
|
|
155
155
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
156
|
-
const replyTo = this.#getReplyTo(params?.
|
|
156
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
157
157
|
return await this.client.sendMessage(chatId, text, { ...params, ...replyTo, businessConnectionId });
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
@@ -161,7 +161,7 @@ class Context {
|
|
|
161
161
|
*/
|
|
162
162
|
async replyDraft(draftId, text, params) {
|
|
163
163
|
const { chatId, messageId } = this.#mustGetMsg();
|
|
164
|
-
const replyTo = this.#getReplyTo(params?.
|
|
164
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
165
165
|
return await this.client.sendMessageDraft(chatId, draftId, text, { ...params, ...replyTo });
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
@@ -169,7 +169,7 @@ class Context {
|
|
|
169
169
|
*/
|
|
170
170
|
async replyPoll(question, options, params) {
|
|
171
171
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
172
|
-
const replyTo = this.#getReplyTo(params?.
|
|
172
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
173
173
|
return await this.client.sendPoll(chatId, question, options, { ...params, ...replyTo, businessConnectionId });
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
@@ -177,7 +177,7 @@ class Context {
|
|
|
177
177
|
*/
|
|
178
178
|
async replyPhoto(photo, params) {
|
|
179
179
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
180
|
-
const replyTo = this.#getReplyTo(params?.
|
|
180
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
181
181
|
return await this.client.sendPhoto(chatId, photo, { ...params, ...replyTo, businessConnectionId });
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
@@ -185,7 +185,7 @@ class Context {
|
|
|
185
185
|
*/
|
|
186
186
|
async replyMediaGroup(media, params) {
|
|
187
187
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
188
|
-
const replyTo = this.#getReplyTo(params?.
|
|
188
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
189
189
|
return await this.client.sendMediaGroup(chatId, media, { ...params, ...replyTo, businessConnectionId });
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
@@ -193,7 +193,7 @@ class Context {
|
|
|
193
193
|
*/
|
|
194
194
|
async replyInvoice(title, description, payload, currency, prices, params) {
|
|
195
195
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
196
|
-
const replyTo = this.#getReplyTo(params?.
|
|
196
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
197
197
|
return await this.client.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, ...replyTo, businessConnectionId });
|
|
198
198
|
}
|
|
199
199
|
/**
|
|
@@ -201,7 +201,7 @@ class Context {
|
|
|
201
201
|
*/
|
|
202
202
|
async replyDocument(document, params) {
|
|
203
203
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
204
|
-
const replyTo = this.#getReplyTo(params?.
|
|
204
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
205
205
|
return await this.client.sendDocument(chatId, document, { ...params, ...replyTo, businessConnectionId });
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
@@ -209,7 +209,7 @@ class Context {
|
|
|
209
209
|
*/
|
|
210
210
|
async replySticker(sticker, params) {
|
|
211
211
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
212
|
-
const replyTo = this.#getReplyTo(params?.
|
|
212
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
213
213
|
return await this.client.sendSticker(chatId, sticker, { ...params, ...replyTo, businessConnectionId });
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
@@ -217,7 +217,7 @@ class Context {
|
|
|
217
217
|
*/
|
|
218
218
|
async replyLocation(latitude, longitude, params) {
|
|
219
219
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
220
|
-
const replyTo = this.#getReplyTo(params?.
|
|
220
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
221
221
|
return await this.client.sendLocation(chatId, latitude, longitude, { ...params, ...replyTo, businessConnectionId });
|
|
222
222
|
}
|
|
223
223
|
/**
|
|
@@ -225,7 +225,7 @@ class Context {
|
|
|
225
225
|
*/
|
|
226
226
|
async replyDice(params) {
|
|
227
227
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
228
|
-
const replyTo = this.#getReplyTo(params?.
|
|
228
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
229
229
|
return await this.client.sendDice(chatId, { ...params, ...replyTo, businessConnectionId });
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
@@ -233,7 +233,7 @@ class Context {
|
|
|
233
233
|
*/
|
|
234
234
|
async replyVenue(latitude, longitude, title, address, params) {
|
|
235
235
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
236
|
-
const replyTo = this.#getReplyTo(params?.
|
|
236
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
237
237
|
return await this.client.sendVenue(chatId, latitude, longitude, title, address, { ...params, ...replyTo, businessConnectionId });
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
@@ -241,7 +241,7 @@ class Context {
|
|
|
241
241
|
*/
|
|
242
242
|
async replyContact(firstName, number, params) {
|
|
243
243
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
244
|
-
const replyTo = this.#getReplyTo(params?.
|
|
244
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
245
245
|
return await this.client.sendContact(chatId, firstName, number, { ...params, ...replyTo, businessConnectionId });
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
@@ -249,7 +249,7 @@ class Context {
|
|
|
249
249
|
*/
|
|
250
250
|
async replyVideo(video, params) {
|
|
251
251
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
252
|
-
const replyTo = this.#getReplyTo(params?.
|
|
252
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
253
253
|
return await this.client.sendVideo(chatId, video, { ...params, ...replyTo, businessConnectionId });
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
@@ -257,7 +257,7 @@ class Context {
|
|
|
257
257
|
*/
|
|
258
258
|
async replyAnimation(animation, params) {
|
|
259
259
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
260
|
-
const replyTo = this.#getReplyTo(params?.
|
|
260
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
261
261
|
return await this.client.sendAnimation(chatId, animation, { ...params, ...replyTo, businessConnectionId });
|
|
262
262
|
}
|
|
263
263
|
/**
|
|
@@ -265,7 +265,7 @@ class Context {
|
|
|
265
265
|
*/
|
|
266
266
|
async replyVoice(voice, params) {
|
|
267
267
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
268
|
-
const replyTo = this.#getReplyTo(params?.
|
|
268
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
269
269
|
return await this.client.sendVoice(chatId, voice, { ...params, ...replyTo, businessConnectionId });
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
@@ -273,7 +273,7 @@ class Context {
|
|
|
273
273
|
*/
|
|
274
274
|
async replyAudio(audio, params) {
|
|
275
275
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
276
|
-
const replyTo = this.#getReplyTo(params?.
|
|
276
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
277
277
|
return await this.client.sendAudio(chatId, audio, { ...params, ...replyTo, businessConnectionId });
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
@@ -281,7 +281,7 @@ class Context {
|
|
|
281
281
|
*/
|
|
282
282
|
async replyVideoNote(videoNote, params) {
|
|
283
283
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
284
|
-
const replyTo = this.#getReplyTo(params?.
|
|
284
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
285
285
|
return await this.client.sendVideoNote(chatId, videoNote, { ...params, ...replyTo, businessConnectionId });
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
@@ -117,7 +117,7 @@ class FileManager {
|
|
|
117
117
|
if (checkName) {
|
|
118
118
|
name = checkName(name, result.firstPart);
|
|
119
119
|
}
|
|
120
|
-
if (result.
|
|
120
|
+
if (result.isSmall) {
|
|
121
121
|
return { _: "inputFile", id: fileId, name, parts: result.parts, md5_checksum: "" };
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
@@ -131,14 +131,14 @@ class FileManager {
|
|
|
131
131
|
let uploaded = 0;
|
|
132
132
|
let firstPart;
|
|
133
133
|
for await (part of (0, _1_utilities_js_1.iterateReadableStream)(stream.pipeThrough(new _1_utilities_js_1.PartStream(chunkSize)))) {
|
|
134
|
-
if (!part.
|
|
134
|
+
if (!part.isSmall && part.part > 0) {
|
|
135
135
|
await (0, _0_deps_js_1.delay)(ms);
|
|
136
136
|
ms = Math.max(ms * .8, 0.003);
|
|
137
137
|
}
|
|
138
138
|
if (!firstPart) {
|
|
139
139
|
firstPart = part.bytes;
|
|
140
140
|
}
|
|
141
|
-
promises.push(this.#uploadPart(fileId, part.totalParts, !part.
|
|
141
|
+
promises.push(this.#uploadPart(fileId, part.totalParts, !part.isSmall, part.part, part.bytes, signal).then(() => {
|
|
142
142
|
if (mustTrackProgress) {
|
|
143
143
|
uploaded += part.bytes.length;
|
|
144
144
|
this.#c.handleUpdate({
|
|
@@ -156,7 +156,7 @@ class FileManager {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
await Promise.all(promises);
|
|
159
|
-
return {
|
|
159
|
+
return { isSmall: part.isSmall, parts: part.totalParts, firstPart };
|
|
160
160
|
}
|
|
161
161
|
async #uploadBuffer(buffer, fileId, mustTrackProgress, chunkSize, poolSize, signal) {
|
|
162
162
|
const isBig = buffer.byteLength > _a.#BIG_FILE_THRESHOLD;
|
|
@@ -207,7 +207,7 @@ class FileManager {
|
|
|
207
207
|
promises = [];
|
|
208
208
|
}
|
|
209
209
|
await Promise.all(promises);
|
|
210
|
-
return {
|
|
210
|
+
return { isSmall: !isBig, parts: partCount, firstPart };
|
|
211
211
|
}
|
|
212
212
|
async #uploadPart(fileId, partCount, isBig, index, bytes, signal) {
|
|
213
213
|
let retryIn = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_network_statistics_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_network_statistics_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEtC,qBAAa,wBAAwB;;gBAIvB,CAAC,EAAE,CAAC;IAKV,oBAAoB;;;;;;;;;;IAmB1B,6BAA6B,CAAC,
|
|
1
|
+
{"version":3,"file":"2_network_statistics_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_network_statistics_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEtC,qBAAa,wBAAwB;;gBAIvB,CAAC,EAAE,CAAC;IAKV,oBAAoB;;;;;;;;;;IAmB1B,6BAA6B,CAAC,MAAM,EAAE,OAAO;sBAE3B,MAAM;uBAKL,MAAM;;CA2B1B"}
|
|
@@ -46,15 +46,15 @@ class NetworkStatisticsManager {
|
|
|
46
46
|
return { messages, cdn };
|
|
47
47
|
}
|
|
48
48
|
#pendingWrites = {};
|
|
49
|
-
getTransportReadWriteCallback(
|
|
49
|
+
getTransportReadWriteCallback(isCcdn) {
|
|
50
50
|
return {
|
|
51
51
|
read: (count) => {
|
|
52
|
-
const key =
|
|
52
|
+
const key = isCcdn ? "netstat_cdn_read" : "netstat_messages_read";
|
|
53
53
|
this.#pendingWrites[key] = (this.#pendingWrites[key] ?? 0) + count;
|
|
54
54
|
this.#write();
|
|
55
55
|
},
|
|
56
56
|
write: (count) => {
|
|
57
|
-
const key =
|
|
57
|
+
const key = isCcdn ? "netstat_cdn_write" : "netstat_messages_write";
|
|
58
58
|
this.#pendingWrites[key] = (this.#pendingWrites[key] ?? 0) + count;
|
|
59
59
|
this.#write();
|
|
60
60
|
},
|
|
@@ -49,7 +49,7 @@ async function signIn(client, logger, params) {
|
|
|
49
49
|
logger.debug("signing in with", typeof params === "string" ? "bot token" : _2_tl_js_1.Api.is("auth.exportedAuthorization", params) ? "exported authorization" : "AuthorizeUserParams");
|
|
50
50
|
if (params && "botToken" in params) {
|
|
51
51
|
const result = await client.checkBotToken(params.botToken);
|
|
52
|
-
if (result.type === "
|
|
52
|
+
if (result.type === "signedIn") {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
@@ -78,13 +78,13 @@ async function signIn(client, logger, params) {
|
|
|
78
78
|
code: while (true) {
|
|
79
79
|
const code = typeof params.code === "string" ? params.code : await params.code();
|
|
80
80
|
const codeCheckResult = await client.checkCode(code);
|
|
81
|
-
if (codeCheckResult.type === "
|
|
81
|
+
if (codeCheckResult.type === "signedIn") {
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
else if (codeCheckResult.type === "
|
|
84
|
+
else if (codeCheckResult.type === "invalidCode") {
|
|
85
85
|
continue code;
|
|
86
86
|
}
|
|
87
|
-
else if (codeCheckResult.type === "
|
|
87
|
+
else if (codeCheckResult.type === "passwordRequired") {
|
|
88
88
|
break code;
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
@@ -95,10 +95,10 @@ async function signIn(client, logger, params) {
|
|
|
95
95
|
password: while (true) {
|
|
96
96
|
const password = typeof params.password === "string" ? params.password : await params.password(passwordHint);
|
|
97
97
|
const passwordCheckResult = await client.checkPassword(password);
|
|
98
|
-
if (passwordCheckResult.type === "
|
|
98
|
+
if (passwordCheckResult.type === "signedIn") {
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
else if (passwordCheckResult.type === "
|
|
101
|
+
else if (passwordCheckResult.type === "invalidPassword") {
|
|
102
102
|
continue password;
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
@@ -959,7 +959,7 @@ class UpdateManager {
|
|
|
959
959
|
const promise = Promise.resolve().then(async () => {
|
|
960
960
|
const logger = this.#LopenChat.branch(_2_tl_js_1.Api.peerToChatId(channel) + "");
|
|
961
961
|
while (true) {
|
|
962
|
-
if (this.#c.
|
|
962
|
+
if (this.#c.isDisconnected()) {
|
|
963
963
|
logger.debug("disconnected, stopping the loop");
|
|
964
964
|
this.#openChats.delete(channelId);
|
|
965
965
|
break;
|
|
@@ -981,7 +981,7 @@ class UpdateManager {
|
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
983
|
catch (err) {
|
|
984
|
-
if (this.#c.
|
|
984
|
+
if (this.#c.isDisconnected()) {
|
|
985
985
|
continue; // breaks the loop
|
|
986
986
|
}
|
|
987
987
|
this.#LopenChat.error("an unexpected error occurred:", err);
|
|
@@ -175,7 +175,7 @@ class MessageManager {
|
|
|
175
175
|
if (_2_tl_js_1.Api.is("updateNewMessage", update) || _2_tl_js_1.Api.is("updateEditMessage", update) || _2_tl_js_1.Api.is("updateNewScheduledMessage", update)) {
|
|
176
176
|
const message = await this.constructMessage(update.message);
|
|
177
177
|
if (_2_tl_js_1.Api.is("updateNewScheduledMessage", update)) {
|
|
178
|
-
message.
|
|
178
|
+
message.isScheduled = true;
|
|
179
179
|
}
|
|
180
180
|
messages.push(message);
|
|
181
181
|
}
|
|
@@ -217,7 +217,7 @@ class MessageManager {
|
|
|
217
217
|
}
|
|
218
218
|
async forwardMessages(from, to, messageIds, params) {
|
|
219
219
|
(0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
|
|
220
|
-
const result = await this.#c.invoke({ _: "messages.forwardMessages", from_peer: await this.#c.getInputPeer(from), to_peer: await this.#c.getInputPeer(to), id: messageIds, random_id: messageIds.map(() => (0, _1_utilities_js_1.getRandomId)()), silent: params?.
|
|
220
|
+
const result = await this.#c.invoke({ _: "messages.forwardMessages", from_peer: await this.#c.getInputPeer(from), to_peer: await this.#c.getInputPeer(to), id: messageIds, random_id: messageIds.map(() => (0, _1_utilities_js_1.getRandomId)()), silent: params?.isSilent || undefined, top_msg_id: params?.messageThreadId, noforwards: params?.isSilent || undefined, send_as: params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined, drop_author: params?.dropSenderName || undefined, drop_media_captions: params?.dropCaption || undefined });
|
|
221
221
|
return await this.updatesToMessages(to, result);
|
|
222
222
|
}
|
|
223
223
|
async getHistory(chatId, params) {
|
|
@@ -290,14 +290,14 @@ class MessageManager {
|
|
|
290
290
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
291
291
|
const peer = await this.#c.getInputPeer(chatId);
|
|
292
292
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
293
|
-
const noWebpage = params?.linkPreview?.
|
|
293
|
+
const noWebpage = params?.linkPreview?.isDisabled ? true : undefined;
|
|
294
294
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
295
|
-
const silent = params?.
|
|
296
|
-
const noforwards = params?.
|
|
295
|
+
const silent = params?.isSilent ? true : undefined;
|
|
296
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
297
297
|
const sendAs = await this.#resolveSendAs(params);
|
|
298
298
|
const effect = params?.effectId ? BigInt(params.effectId) : undefined;
|
|
299
299
|
const schedule_date = params?.sendAt;
|
|
300
|
-
const allow_paid_floodskip = params?.
|
|
300
|
+
const allow_paid_floodskip = params?.isPaidBroadcast ? true : undefined;
|
|
301
301
|
let result;
|
|
302
302
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
303
303
|
result = await this.#c.invoke({
|
|
@@ -367,8 +367,8 @@ class MessageManager {
|
|
|
367
367
|
this.#checkParams(params);
|
|
368
368
|
const peer = await this.#c.getInputPeer(chatId);
|
|
369
369
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
370
|
-
const silent = params?.
|
|
371
|
-
const noforwards = params?.
|
|
370
|
+
const silent = params?.isSilent ? true : undefined;
|
|
371
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
372
372
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
373
373
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
374
374
|
const result = await this.#c.invoke({
|
|
@@ -396,7 +396,7 @@ class MessageManager {
|
|
|
396
396
|
message: "",
|
|
397
397
|
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
398
398
|
schedule_date: params?.sendAt,
|
|
399
|
-
allow_paid_floodskip: params?.
|
|
399
|
+
allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
|
|
400
400
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
401
401
|
const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
402
402
|
return (0, _3_types_js_2.assertMessageType)(message, "venue");
|
|
@@ -405,8 +405,8 @@ class MessageManager {
|
|
|
405
405
|
this.#checkParams(params);
|
|
406
406
|
const peer = await this.#c.getInputPeer(chatId);
|
|
407
407
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
408
|
-
const silent = params?.
|
|
409
|
-
const noforwards = params?.
|
|
408
|
+
const silent = params?.isSilent ? true : undefined;
|
|
409
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
410
410
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
411
411
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
412
412
|
const result = await this.#c.invoke({
|
|
@@ -428,7 +428,7 @@ class MessageManager {
|
|
|
428
428
|
message: "",
|
|
429
429
|
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
430
430
|
schedule_date: params?.sendAt,
|
|
431
|
-
allow_paid_floodskip: params?.
|
|
431
|
+
allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
|
|
432
432
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
433
433
|
const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
434
434
|
return (0, _3_types_js_2.assertMessageType)(message, "contact");
|
|
@@ -437,8 +437,8 @@ class MessageManager {
|
|
|
437
437
|
this.#checkParams(params);
|
|
438
438
|
const peer = await this.#c.getInputPeer(chatId);
|
|
439
439
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
440
|
-
const silent = params?.
|
|
441
|
-
const noforwards = params?.
|
|
440
|
+
const silent = params?.isSilent ? true : undefined;
|
|
441
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
442
442
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
443
443
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
444
444
|
const result = await this.#c.invoke({
|
|
@@ -457,7 +457,7 @@ class MessageManager {
|
|
|
457
457
|
message: "",
|
|
458
458
|
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
459
459
|
schedule_date: params?.sendAt,
|
|
460
|
-
allow_paid_floodskip: params?.
|
|
460
|
+
allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
|
|
461
461
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
462
462
|
const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
463
463
|
return (0, _3_types_js_2.assertMessageType)(message, "dice");
|
|
@@ -466,8 +466,8 @@ class MessageManager {
|
|
|
466
466
|
this.#checkParams(params);
|
|
467
467
|
const peer = await this.#c.getInputPeer(chatId);
|
|
468
468
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
469
|
-
const silent = params?.
|
|
470
|
-
const noforwards = params?.
|
|
469
|
+
const silent = params?.isSilent ? true : undefined;
|
|
470
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
471
471
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
472
472
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
473
473
|
const result = await this.#c.invoke({
|
|
@@ -504,7 +504,7 @@ class MessageManager {
|
|
|
504
504
|
message: "",
|
|
505
505
|
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
506
506
|
schedule_date: params?.sendAt,
|
|
507
|
-
allow_paid_floodskip: params?.
|
|
507
|
+
allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
|
|
508
508
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
509
509
|
const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
510
510
|
return (0, _3_types_js_2.assertMessageType)(message, "location");
|
|
@@ -680,8 +680,8 @@ class MessageManager {
|
|
|
680
680
|
}
|
|
681
681
|
const peer = await this.#c.getInputPeer(chatId);
|
|
682
682
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
683
|
-
const silent = params?.
|
|
684
|
-
const noforwards = params?.
|
|
683
|
+
const silent = params?.isSilent ? true : undefined;
|
|
684
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
685
685
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
686
686
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
687
687
|
const caption_ = params?.caption;
|
|
@@ -702,7 +702,7 @@ class MessageManager {
|
|
|
702
702
|
entities: captionEntities,
|
|
703
703
|
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
704
704
|
schedule_date: params?.sendAt,
|
|
705
|
-
allow_paid_floodskip: params?.
|
|
705
|
+
allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
|
|
706
706
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
707
707
|
return (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
708
708
|
}
|
|
@@ -738,8 +738,8 @@ class MessageManager {
|
|
|
738
738
|
}
|
|
739
739
|
const peer = await this.#c.getInputPeer(chatId);
|
|
740
740
|
const randomId = (0, _1_utilities_js_1.getRandomId)();
|
|
741
|
-
const silent = params?.
|
|
742
|
-
const noforwards = params?.
|
|
741
|
+
const silent = params?.isSilent ? true : undefined;
|
|
742
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
743
743
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
744
744
|
const replyMarkup = await this.#constructReplyMarkup(params);
|
|
745
745
|
const explanation = params?.explanation;
|
|
@@ -768,7 +768,7 @@ class MessageManager {
|
|
|
768
768
|
message: "",
|
|
769
769
|
effect: params?.effectId ? BigInt(params.effectId) : undefined,
|
|
770
770
|
schedule_date: params?.sendAt,
|
|
771
|
-
allow_paid_floodskip: params?.
|
|
771
|
+
allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
|
|
772
772
|
}, { businessConnectionId: params?.businessConnectionId });
|
|
773
773
|
const message = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
|
|
774
774
|
return (0, _3_types_js_2.assertMessageType)(message, "poll");
|
|
@@ -810,7 +810,7 @@ class MessageManager {
|
|
|
810
810
|
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
811
811
|
throw new _0_errors_js_1.InputError("Expected link preview of type input.");
|
|
812
812
|
}
|
|
813
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.
|
|
813
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
|
|
814
814
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
815
815
|
let media = undefined;
|
|
816
816
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
@@ -866,7 +866,7 @@ class MessageManager {
|
|
|
866
866
|
if (params?.linkPreview && params.linkPreview.type !== "input") {
|
|
867
867
|
throw new _0_errors_js_1.InputError("Expected link preview of type input.");
|
|
868
868
|
}
|
|
869
|
-
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.
|
|
869
|
+
const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.isDisabled ? true : undefined;
|
|
870
870
|
const invertMedia = params?.linkPreview?.isAboveText ? true : undefined;
|
|
871
871
|
let media = undefined;
|
|
872
872
|
if (!noWebpage && params?.linkPreview?.url) {
|
|
@@ -1077,7 +1077,7 @@ class MessageManager {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
async pinMessage(chatId, messageId, params) {
|
|
1079
1079
|
this.#checkParams(params);
|
|
1080
|
-
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.
|
|
1080
|
+
await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.isSilent ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
|
|
1081
1081
|
}
|
|
1082
1082
|
async unpinMessage(chatId, messageId, params) {
|
|
1083
1083
|
this.#checkParams(params);
|
|
@@ -1087,7 +1087,7 @@ class MessageManager {
|
|
|
1087
1087
|
await this.#c.invoke({ _: "messages.unpinAllMessages", peer: await this.#c.getInputPeer(chatId) });
|
|
1088
1088
|
}
|
|
1089
1089
|
async #sendReaction(chatId, messageId, reactions, params) {
|
|
1090
|
-
await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.
|
|
1090
|
+
await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.isBig ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
|
|
1091
1091
|
}
|
|
1092
1092
|
async setReactions(chatId, messageId, reactions, params) {
|
|
1093
1093
|
await this.#sendReaction(chatId, messageId, reactions, params);
|
|
@@ -1097,7 +1097,7 @@ class MessageManager {
|
|
|
1097
1097
|
if (!message) {
|
|
1098
1098
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
1099
1099
|
}
|
|
1100
|
-
const chosenReactions = (message.reactions ?? []).filter((v) => v.
|
|
1100
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.isChosen);
|
|
1101
1101
|
for (const r of chosenReactions) {
|
|
1102
1102
|
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
1103
1103
|
return;
|
|
@@ -1111,7 +1111,7 @@ class MessageManager {
|
|
|
1111
1111
|
if (!message) {
|
|
1112
1112
|
throw new _0_errors_js_1.InputError("Message not found.");
|
|
1113
1113
|
}
|
|
1114
|
-
const chosenReactions = (message.reactions ?? []).filter((v) => v.
|
|
1114
|
+
const chosenReactions = (message.reactions ?? []).filter((v) => v.isChosen);
|
|
1115
1115
|
for (const r of chosenReactions) {
|
|
1116
1116
|
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
1117
1117
|
const reactions = chosenReactions.filter((v) => v !== r).map((v) => v.reaction);
|
|
@@ -1157,7 +1157,7 @@ class MessageManager {
|
|
|
1157
1157
|
return { message };
|
|
1158
1158
|
}
|
|
1159
1159
|
else if (_2_tl_js_1.Api.is("updateNewScheduledMessage", update)) {
|
|
1160
|
-
message.
|
|
1160
|
+
message.isScheduled = true;
|
|
1161
1161
|
return { scheduledMessage: message };
|
|
1162
1162
|
}
|
|
1163
1163
|
else {
|
|
@@ -1372,7 +1372,7 @@ class MessageManager {
|
|
|
1372
1372
|
shipping_address_requested: params?.needShippingAddress || undefined,
|
|
1373
1373
|
email_to_provider: params?.sendEmailToProvider || undefined,
|
|
1374
1374
|
phone_to_provider: params?.sendPhoneNumberToProvider || undefined,
|
|
1375
|
-
flexible: params?.
|
|
1375
|
+
flexible: params?.isFlexible || undefined,
|
|
1376
1376
|
};
|
|
1377
1377
|
const message = await this.#sendMedia(chatId, {
|
|
1378
1378
|
_: "inputMediaInvoice",
|
|
@@ -1441,8 +1441,8 @@ class MessageManager {
|
|
|
1441
1441
|
multiMedia[i] = { ...media_, media: { _: "inputMediaDocument", id: { ...document, _: "inputDocument" } } };
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
const silent = params?.
|
|
1445
|
-
const noforwards = params?.
|
|
1444
|
+
const silent = params?.isSilent ? true : undefined;
|
|
1445
|
+
const noforwards = params?.isContentProtected ? true : undefined;
|
|
1446
1446
|
const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
|
|
1447
1447
|
const result = await this.#c.invoke({
|
|
1448
1448
|
_: "messages.sendMultiMedia",
|
|
@@ -1453,7 +1453,7 @@ class MessageManager {
|
|
|
1453
1453
|
silent,
|
|
1454
1454
|
send_as: sendAs,
|
|
1455
1455
|
reply_to: await this.#constructReplyTo(params),
|
|
1456
|
-
allow_paid_floodskip: params?.
|
|
1456
|
+
allow_paid_floodskip: params?.isPaidBroadcast ? true : undefined,
|
|
1457
1457
|
});
|
|
1458
1458
|
return await this.updatesToMessages(chatId, result);
|
|
1459
1459
|
}
|
|
@@ -1500,7 +1500,7 @@ class MessageManager {
|
|
|
1500
1500
|
return null;
|
|
1501
1501
|
}
|
|
1502
1502
|
const voiceTranscription = await this.#c.messageStorage.getVoiceTranscription(reference);
|
|
1503
|
-
if (!voiceTranscription || !voiceTranscription.
|
|
1503
|
+
if (!voiceTranscription || !voiceTranscription.isCompleted) {
|
|
1504
1504
|
return null;
|
|
1505
1505
|
}
|
|
1506
1506
|
return voiceTranscription;
|
|
@@ -1631,8 +1631,8 @@ class MessageManager {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
async openMiniApp(botId, chatId, params) {
|
|
1633
1633
|
this.#c.storage.assertUser("openMiniApp");
|
|
1634
|
-
const from_bot_menu = params?.
|
|
1635
|
-
const silent = params?.
|
|
1634
|
+
const from_bot_menu = params?.isFromMenu ? true : undefined;
|
|
1635
|
+
const silent = params?.isSilent ? true : undefined;
|
|
1636
1636
|
const compact = params?.mode === "compact" ? true : undefined;
|
|
1637
1637
|
const fullscreen = params?.mode === "fullscreen" ? true : undefined;
|
|
1638
1638
|
const peer = await this.#c.getInputPeer(chatId);
|
|
@@ -51,11 +51,11 @@ class VideoChatManager {
|
|
|
51
51
|
}
|
|
52
52
|
async startVideoChat(chatId, params) {
|
|
53
53
|
this.#c.storage.assertUser("startVideoChat");
|
|
54
|
-
return await this.#createGroupCall(chatId, params?.title, params?.
|
|
54
|
+
return await this.#createGroupCall(chatId, params?.title, params?.isLiveStream || undefined);
|
|
55
55
|
}
|
|
56
56
|
async scheduleVideoChat(chatId, startAt, params) {
|
|
57
57
|
this.#c.storage.assertUser("scheduleVideoChat");
|
|
58
|
-
return await this.#createGroupCall(chatId, params?.title, params?.
|
|
58
|
+
return await this.#createGroupCall(chatId, params?.title, params?.isLiveStream || undefined, startAt);
|
|
59
59
|
}
|
|
60
60
|
async #getInputGroupCall(id_) {
|
|
61
61
|
const id = BigInt(id_);
|
|
@@ -68,7 +68,7 @@ class VideoChatManager {
|
|
|
68
68
|
async joinVideoChat(id, params, params_) {
|
|
69
69
|
this.#c.storage.assertUser("joinVideoChat");
|
|
70
70
|
const call = await this.#getInputGroupCall(id);
|
|
71
|
-
const { updates } = await this.#c.invoke({ _: "phone.joinGroupCall", call, join_as: params_?.joinAs ? await this.#c.getInputPeer(params_.joinAs) : { _: "inputPeerSelf" }, params: { _: "dataJSON", data: params }, invite_hash: params_?.inviteHash, muted: params_?.
|
|
71
|
+
const { updates } = await this.#c.invoke({ _: "phone.joinGroupCall", call, join_as: params_?.joinAs ? await this.#c.getInputPeer(params_.joinAs) : { _: "inputPeerSelf" }, params: { _: "dataJSON", data: params }, invite_hash: params_?.inviteHash, muted: params_?.isAudioEnabled ? undefined : true, video_stopped: params_?.isVideoEnabled ? undefined : true }).then((v) => _2_tl_js_1.Api.as("updates", v));
|
|
72
72
|
const updateGroupCall = updates
|
|
73
73
|
.find((v) => _2_tl_js_1.Api.is("updateGroupCallConnection", v));
|
|
74
74
|
if (!updateGroupCall)
|
|
@@ -38,7 +38,7 @@ class CallbackQueryManager {
|
|
|
38
38
|
async answerCallbackQuery(id, params) {
|
|
39
39
|
this.#c.storage.assertBot("answerCallbackQuery");
|
|
40
40
|
(0, _0_utilities_js_1.checkCallbackQueryId)(id);
|
|
41
|
-
await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.
|
|
41
|
+
await this.#c.invoke({ _: "messages.setBotCallbackAnswer", query_id: BigInt(id), cache_time: params?.cacheTime ?? 0, message: params?.text, alert: params?.isAlert ? true : undefined });
|
|
42
42
|
}
|
|
43
43
|
async sendCallbackQuery(botId, messageId, question) {
|
|
44
44
|
this.#c.storage.assertUser("sendCallbackQuery");
|
|
@@ -256,7 +256,7 @@ class ChatListManager {
|
|
|
256
256
|
_: "channels.createChannel",
|
|
257
257
|
broadcast: type === "channel" ? true : undefined,
|
|
258
258
|
megagroup: type === "supergroup" ? true : undefined,
|
|
259
|
-
forum: params && ("
|
|
259
|
+
forum: params && ("isForum" in params) && params.isForum ? true : undefined,
|
|
260
260
|
title,
|
|
261
261
|
about: params?.description || "",
|
|
262
262
|
ttl_period: params?.messageTtl || undefined,
|
|
@@ -59,9 +59,9 @@ class ChatManager {
|
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
// JOIN REQUESTS //
|
|
62
|
-
async #toggleJoinRequests(chatId,
|
|
62
|
+
async #toggleJoinRequests(chatId, isEnabled) {
|
|
63
63
|
const channel = await this.#c.getInputChannel(chatId);
|
|
64
|
-
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled });
|
|
64
|
+
await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled: isEnabled });
|
|
65
65
|
}
|
|
66
66
|
async approveJoinRequest(chatId, userId) {
|
|
67
67
|
await this.#c.invoke({
|
|
@@ -117,15 +117,15 @@ class ChatManager {
|
|
|
117
117
|
}
|
|
118
118
|
// INVITE LINKS //
|
|
119
119
|
async createInviteLink(chatId, params) {
|
|
120
|
-
if (params?.
|
|
121
|
-
throw new _0_errors_js_1.InputError("
|
|
120
|
+
if (params?.isApprovalRequired && params?.limit) {
|
|
121
|
+
throw new _0_errors_js_1.InputError("isApprovalRequired cannot be true while limit is specified.");
|
|
122
122
|
}
|
|
123
|
-
const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.
|
|
123
|
+
const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.isApprovalRequired ? true : undefined, usage_limit: params?.limit });
|
|
124
124
|
return (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result), this.#c.getPeer);
|
|
125
125
|
}
|
|
126
126
|
async getCreatedInviteLinks(chatId, params) {
|
|
127
127
|
this.#c.storage.assertUser("getCreatedInviteLinks");
|
|
128
|
-
const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.
|
|
128
|
+
const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.isRevoked ? true : undefined, admin_id: params?.by ? await this.#c.getInputUser(params.by) : { _: "inputUserEmpty" }, limit: (0, _0_utilities_js_1.getLimit)(params?.limit), offset_date: params?.afterDate, offset_link: params?.afterInviteLink });
|
|
129
129
|
return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v, this.#c.getPeer)));
|
|
130
130
|
}
|
|
131
131
|
// JOINING AND LEAVING CHATS //
|