@mtkruto/browser 0.119.0 → 0.119.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/0_errors.d.ts.map +1 -1
- package/esm/0_errors.js +9 -31
- package/esm/3_errors.js +2 -12
- package/esm/4_errors.js +2 -12
- package/esm/_dnt.polyfills.d.ts +0 -99
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +1 -127
- package/esm/client/0_abortable_loop.js +26 -39
- package/esm/client/0_storage_operations.js +179 -218
- package/esm/client/1_client_plain.js +4 -22
- package/esm/client/2_account_manager.js +140 -149
- package/esm/client/2_bot_info_manager.js +26 -38
- package/esm/client/2_business_connection_manager.js +10 -23
- package/esm/client/2_client_encrypted.js +198 -215
- package/esm/client/2_file_manager.js +255 -262
- package/esm/client/2_network_statistics_manager.js +31 -44
- package/esm/client/2_payment_manager.js +7 -20
- package/esm/client/2_reaction_manager.js +7 -20
- package/esm/client/2_translations_manager.js +101 -111
- package/esm/client/2_update_manager.js +750 -745
- package/esm/client/3_client_encrypted_pool.js +10 -26
- package/esm/client/3_message_manager.js +503 -508
- package/esm/client/3_video_chat_manager.js +57 -68
- package/esm/client/4_callback_query_manager.js +18 -30
- package/esm/client/4_chat_list_manager.js +140 -146
- package/esm/client/4_chat_manager.js +161 -169
- package/esm/client/4_checklist_manager.js +26 -39
- package/esm/client/4_context.js +244 -259
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.js +22 -35
- package/esm/client/4_inline_query_manager.js +16 -28
- package/esm/client/4_link_preview_manager.js +6 -19
- package/esm/client/4_poll_manager.js +44 -57
- package/esm/client/4_story_manager.js +41 -53
- package/esm/client/5_composer.js +13 -26
- package/esm/client/6_client.js +866 -896
- package/esm/client/6_client_dispatcher.js +308 -325
- package/esm/client/7_client_worker.js +16 -29
- package/esm/connection/1_connection_tcp.js +55 -82
- package/esm/connection/1_connection_web_socket.js +75 -91
- package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/esm/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
- package/esm/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
- package/esm/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.js +422 -420
- package/esm/storage/2_storage_indexed_db.js +26 -44
- package/esm/storage/2_storage_local_storage.js +3 -16
- package/esm/storage/2_storage_memory.js +24 -41
- package/esm/storage/2_storage_session_storage.js +3 -16
- package/esm/tl/1_tl_reader.d.ts +1 -1
- package/esm/tl/1_tl_reader.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +95 -103
- package/esm/tl/1_tl_writer.js +169 -178
- package/esm/transport/0_transport.js +1 -8
- package/esm/transport/1_transport_abridged.js +11 -24
- package/esm/transport/1_transport_intermediate.js +10 -23
- package/esm/utilities/0_mutex.js +4 -19
- package/esm/utilities/0_part_stream.js +11 -25
- package/esm/utilities/1_crypto.js +42 -53
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_errors.d.ts.map +1 -1
- package/script/0_errors.js +9 -31
- package/script/3_errors.js +2 -12
- package/script/4_errors.js +2 -12
- package/script/_dnt.polyfills.d.ts +0 -99
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +0 -128
- package/script/client/0_abortable_loop.js +27 -40
- package/script/client/0_storage_operations.js +179 -218
- package/script/client/1_client_plain.js +4 -22
- package/script/client/2_account_manager.js +140 -149
- package/script/client/2_bot_info_manager.js +26 -38
- package/script/client/2_business_connection_manager.js +10 -23
- package/script/client/2_client_encrypted.js +199 -216
- package/script/client/2_file_manager.js +255 -262
- package/script/client/2_network_statistics_manager.js +32 -45
- package/script/client/2_payment_manager.js +7 -20
- package/script/client/2_reaction_manager.js +7 -20
- package/script/client/2_translations_manager.js +102 -112
- package/script/client/2_update_manager.js +750 -745
- package/script/client/3_client_encrypted_pool.js +10 -26
- package/script/client/3_message_manager.js +503 -508
- package/script/client/3_video_chat_manager.js +57 -68
- package/script/client/4_callback_query_manager.js +18 -30
- package/script/client/4_chat_list_manager.js +140 -146
- package/script/client/4_chat_manager.js +161 -169
- package/script/client/4_checklist_manager.js +26 -39
- package/script/client/4_context.js +244 -259
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.js +22 -35
- package/script/client/4_inline_query_manager.js +16 -28
- package/script/client/4_link_preview_manager.js +6 -19
- package/script/client/4_poll_manager.js +44 -57
- package/script/client/4_story_manager.js +41 -53
- package/script/client/5_composer.js +13 -26
- package/script/client/6_client.js +866 -896
- package/script/client/6_client_dispatcher.js +308 -325
- package/script/client/7_client_worker.js +16 -29
- package/script/connection/1_connection_tcp.js +55 -82
- package/script/connection/1_connection_web_socket.js +75 -91
- package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/script/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
- package/script/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
- package/script/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.js +49 -72
- package/script/session/2_session_encrypted.js +423 -421
- package/script/storage/2_storage_indexed_db.js +26 -44
- package/script/storage/2_storage_local_storage.js +3 -16
- package/script/storage/2_storage_memory.js +24 -41
- package/script/storage/2_storage_session_storage.js +3 -16
- package/script/tl/1_tl_reader.d.ts +1 -1
- package/script/tl/1_tl_reader.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +96 -104
- package/script/tl/1_tl_writer.js +170 -179
- package/script/transport/0_transport.js +1 -8
- package/script/transport/1_transport_abridged.js +11 -24
- package/script/transport/1_transport_intermediate.js +10 -23
- package/script/utilities/0_mutex.js +4 -19
- package/script/utilities/0_part_stream.js +11 -25
- package/script/utilities/1_crypto.js +43 -54
- package/script/utilities/2_queue.js +30 -48
package/esm/client/4_context.js
CHANGED
|
@@ -17,18 +17,6 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
21
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
22
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
23
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
24
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
25
|
-
};
|
|
26
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
28
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
29
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
-
};
|
|
31
|
-
var _Context_instances, _Context_client, _Context_me, _Context_update, _Context_mustGetMsg, _Context_mustGetChatId, _Context_mustGetUserId, _Context_mustGetInlineMsgId, _Context_getReplyTo;
|
|
32
20
|
import { unreachable } from "../0_deps.js";
|
|
33
21
|
import { InputError } from "../0_errors.js";
|
|
34
22
|
import { toJSON } from "../2_tl.js";
|
|
@@ -153,41 +141,23 @@ const staticHas = {
|
|
|
153
141
|
* It wraps the {@link Update} type with shortcuts and method aliases.
|
|
154
142
|
*/
|
|
155
143
|
export class Context {
|
|
144
|
+
#client;
|
|
145
|
+
#me;
|
|
146
|
+
#update;
|
|
156
147
|
constructor(client, me, update) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
_Context_update.set(this, void 0);
|
|
161
|
-
_Context_getReplyTo.set(this, (isQuoted, chatId, messageId) => {
|
|
162
|
-
if ("story" in this.update) {
|
|
163
|
-
return { replyTo: { chatId: this.update.story.chat.id, storyId: this.update.story.id } };
|
|
164
|
-
}
|
|
165
|
-
let messageThreadId = undefined;
|
|
166
|
-
if ("message" in this.update) {
|
|
167
|
-
messageThreadId = this.update.message.threadId;
|
|
168
|
-
}
|
|
169
|
-
else if ("editedMessage" in this.update) {
|
|
170
|
-
messageThreadId = this.update.editedMessage.threadId;
|
|
171
|
-
}
|
|
172
|
-
else if ("scheduledMessage" in this.update) {
|
|
173
|
-
messageThreadId = this.update.scheduledMessage.threadId;
|
|
174
|
-
}
|
|
175
|
-
const isPrivate = chatId > 0;
|
|
176
|
-
const shouldQuote = isQuoted === undefined ? !isPrivate : isQuoted;
|
|
177
|
-
return { messageThreadId, replyTo: shouldQuote ? { messageId } : undefined };
|
|
178
|
-
});
|
|
179
|
-
__classPrivateFieldSet(this, _Context_client, client, "f");
|
|
180
|
-
__classPrivateFieldSet(this, _Context_me, me, "f");
|
|
181
|
-
__classPrivateFieldSet(this, _Context_update, update, "f");
|
|
148
|
+
this.#client = client;
|
|
149
|
+
this.#me = me;
|
|
150
|
+
this.#update = update;
|
|
182
151
|
}
|
|
152
|
+
static has = staticHas;
|
|
183
153
|
get update() {
|
|
184
|
-
return
|
|
154
|
+
return this.#update;
|
|
185
155
|
}
|
|
186
156
|
get me() {
|
|
187
|
-
return
|
|
157
|
+
return this.#me;
|
|
188
158
|
}
|
|
189
159
|
get client() {
|
|
190
|
-
return
|
|
160
|
+
return this.#client;
|
|
191
161
|
}
|
|
192
162
|
get msg() {
|
|
193
163
|
return "message" in this.update ? this.update.message : "editedMessage" in this.update ? this.update.editedMessage : "scheduledMessage" in this.update ? this.update.scheduledMessage : "callbackQuery" in this.update ? this.update.callbackQuery.message : undefined;
|
|
@@ -207,6 +177,71 @@ export class Context {
|
|
|
207
177
|
get chosenInlineResult() {
|
|
208
178
|
return "chosenInlineResult" in this.update ? this.update.chosenInlineResult : undefined;
|
|
209
179
|
}
|
|
180
|
+
#mustGetMsg() {
|
|
181
|
+
if (this.msg !== undefined) {
|
|
182
|
+
return { chatId: this.msg.chat.id, messageId: this.msg.id, businessConnectionId: this.msg.businessConnectionId, senderId: this.msg.from?.id, userId: this.msg.from?.id };
|
|
183
|
+
}
|
|
184
|
+
const reactions = "messageInteractions" in this.update ? this.update.messageInteractions : undefined;
|
|
185
|
+
if (reactions !== undefined) {
|
|
186
|
+
return { chatId: reactions.chatId, messageId: reactions.messageId };
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
unreachable();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
#mustGetChatId() {
|
|
193
|
+
if (this.chat) {
|
|
194
|
+
return this.chat.id;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
unreachable();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
#mustGetUserId() {
|
|
201
|
+
if (this.msg?.from) {
|
|
202
|
+
return this.msg.from.id;
|
|
203
|
+
}
|
|
204
|
+
else if ("callbackQuery" in this.update) {
|
|
205
|
+
return this.update.callbackQuery.from.id;
|
|
206
|
+
}
|
|
207
|
+
else if ("chosenInlineResult" in this.update) {
|
|
208
|
+
return this.update.chosenInlineResult.from.id;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
unreachable();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
#mustGetInlineMsgId() {
|
|
215
|
+
if ("chosenInlineResult" in this.update) {
|
|
216
|
+
if (this.update.chosenInlineResult.inlineMessageId) {
|
|
217
|
+
return this.update.chosenInlineResult.inlineMessageId;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else if ("callbackQuery" in this.update) {
|
|
221
|
+
if (this.update.callbackQuery.inlineMessageId) {
|
|
222
|
+
return this.update.callbackQuery.inlineMessageId;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
unreachable();
|
|
226
|
+
}
|
|
227
|
+
#getReplyTo = (isQuoted, chatId, messageId) => {
|
|
228
|
+
if ("story" in this.update) {
|
|
229
|
+
return { replyTo: { chatId: this.update.story.chat.id, storyId: this.update.story.id } };
|
|
230
|
+
}
|
|
231
|
+
let messageThreadId = undefined;
|
|
232
|
+
if ("message" in this.update) {
|
|
233
|
+
messageThreadId = this.update.message.threadId;
|
|
234
|
+
}
|
|
235
|
+
else if ("editedMessage" in this.update) {
|
|
236
|
+
messageThreadId = this.update.editedMessage.threadId;
|
|
237
|
+
}
|
|
238
|
+
else if ("scheduledMessage" in this.update) {
|
|
239
|
+
messageThreadId = this.update.scheduledMessage.threadId;
|
|
240
|
+
}
|
|
241
|
+
const isPrivate = chatId > 0;
|
|
242
|
+
const shouldQuote = isQuoted === undefined ? !isPrivate : isQuoted;
|
|
243
|
+
return { messageThreadId, replyTo: shouldQuote ? { messageId } : undefined };
|
|
244
|
+
};
|
|
210
245
|
get chat() {
|
|
211
246
|
return this.msg?.chat ?? ("messageReactions" in this.update ? this.update.messageReactions.chat : "messageReactionCount" in this.update ? this.update.messageReactionCount.chat : "chatMember" in this.update ? this.update.chatMember.chat : "myChatMember" in this.update ? this.update.myChatMember.chat : "joinRequest" in this.update ? this.update.joinRequest.chat : "story" in this.update ? this.update.story.chat : undefined);
|
|
212
247
|
}
|
|
@@ -249,49 +284,49 @@ export class Context {
|
|
|
249
284
|
* Context-aware alias for {@link Client.addContact}.
|
|
250
285
|
*/
|
|
251
286
|
async addAsContact(params) {
|
|
252
|
-
const chatId =
|
|
287
|
+
const chatId = this.#mustGetChatId();
|
|
253
288
|
return await this.client.addContact(chatId, params);
|
|
254
289
|
}
|
|
255
290
|
/**
|
|
256
291
|
* Context-aware alias for {@link Client.addChatMember}.
|
|
257
292
|
*/
|
|
258
293
|
async addMember(userId, params) {
|
|
259
|
-
const chatId =
|
|
294
|
+
const chatId = this.#mustGetChatId();
|
|
260
295
|
return await this.client.addChatMember(chatId, userId, params);
|
|
261
296
|
}
|
|
262
297
|
/**
|
|
263
298
|
* Context-aware alias for {@link Client.addChatMembers}.
|
|
264
299
|
*/
|
|
265
300
|
async addMembers(userIds) {
|
|
266
|
-
const chatId =
|
|
301
|
+
const chatId = this.#mustGetChatId();
|
|
267
302
|
return await this.client.addChatMembers(chatId, userIds);
|
|
268
303
|
}
|
|
269
304
|
/**
|
|
270
305
|
* Context-aware alias for {@link Client.addReaction}.
|
|
271
306
|
*/
|
|
272
307
|
async addReaction(messageId, reaction, params) {
|
|
273
|
-
const chatId =
|
|
308
|
+
const chatId = this.#mustGetChatId();
|
|
274
309
|
return await this.client.addReaction(chatId, messageId, reaction, params);
|
|
275
310
|
}
|
|
276
311
|
/**
|
|
277
312
|
* Context-aware alias for {@link Client.addStoriesToHighlights}.
|
|
278
313
|
*/
|
|
279
314
|
async addStoriesToHighlights(storyIds) {
|
|
280
|
-
const chatId =
|
|
315
|
+
const chatId = this.#mustGetChatId();
|
|
281
316
|
return await this.client.addStoriesToHighlights(chatId, storyIds);
|
|
282
317
|
}
|
|
283
318
|
/**
|
|
284
319
|
* Context-aware alias for {@link Client.addStoryToHighlights}.
|
|
285
320
|
*/
|
|
286
321
|
async addStoryToHighlights(storyId) {
|
|
287
|
-
const chatId =
|
|
322
|
+
const chatId = this.#mustGetChatId();
|
|
288
323
|
return await this.client.addStoryToHighlights(chatId, storyId);
|
|
289
324
|
}
|
|
290
325
|
/**
|
|
291
326
|
* Context-aware alias for {@link Client.addToChecklist}.
|
|
292
327
|
*/
|
|
293
328
|
async addToChecklist(messageId, items) {
|
|
294
|
-
const chatId =
|
|
329
|
+
const chatId = this.#mustGetChatId();
|
|
295
330
|
return await this.client.addToChecklist(chatId, messageId, items);
|
|
296
331
|
}
|
|
297
332
|
/**
|
|
@@ -325,7 +360,7 @@ export class Context {
|
|
|
325
360
|
* Context-aware alias for {@link Client.approveJoinRequest}.
|
|
326
361
|
*/
|
|
327
362
|
async approveJoinRequest() {
|
|
328
|
-
const { chatId, userId } =
|
|
363
|
+
const { chatId, userId } = this.#mustGetMsg();
|
|
329
364
|
if (!userId) {
|
|
330
365
|
unreachable();
|
|
331
366
|
}
|
|
@@ -335,28 +370,28 @@ export class Context {
|
|
|
335
370
|
* Context-aware alias for {@link Client.approveJoinRequests}.
|
|
336
371
|
*/
|
|
337
372
|
async approveJoinRequests(params) {
|
|
338
|
-
const chatId =
|
|
373
|
+
const chatId = this.#mustGetChatId();
|
|
339
374
|
return await this.client.approveJoinRequests(chatId, params);
|
|
340
375
|
}
|
|
341
376
|
/**
|
|
342
377
|
* Context-aware alias for {@link Client.archiveChat}.
|
|
343
378
|
*/
|
|
344
379
|
async archive() {
|
|
345
|
-
const chatId =
|
|
380
|
+
const chatId = this.#mustGetChatId();
|
|
346
381
|
return await this.client.archiveChat(chatId);
|
|
347
382
|
}
|
|
348
383
|
/**
|
|
349
384
|
* Context-aware alias for {@link Client.banChatMember}.
|
|
350
385
|
*/
|
|
351
386
|
async banChatMember(memberId, params) {
|
|
352
|
-
const chatId =
|
|
387
|
+
const chatId = this.#mustGetChatId();
|
|
353
388
|
return await this.client.banChatMember(chatId, memberId, params);
|
|
354
389
|
}
|
|
355
390
|
/**
|
|
356
391
|
* Context-aware alias for {@link Client.banChatMember}.
|
|
357
392
|
*/
|
|
358
393
|
async banSender(params) {
|
|
359
|
-
const { chatId, senderId } =
|
|
394
|
+
const { chatId, senderId } = this.#mustGetMsg();
|
|
360
395
|
if (!senderId) {
|
|
361
396
|
unreachable();
|
|
362
397
|
}
|
|
@@ -366,62 +401,62 @@ export class Context {
|
|
|
366
401
|
* Context-aware alias for {@link Client.blockUser}.
|
|
367
402
|
*/
|
|
368
403
|
async blockUser() {
|
|
369
|
-
return await this.client.blockUser(
|
|
404
|
+
return await this.client.blockUser(this.#mustGetUserId());
|
|
370
405
|
}
|
|
371
406
|
/**
|
|
372
407
|
* Context-aware alias for {@link Client.checkChecklistItem}.
|
|
373
408
|
*/
|
|
374
409
|
async checkChecklistItem(messageId, item) {
|
|
375
|
-
const chatId =
|
|
410
|
+
const chatId = this.#mustGetChatId();
|
|
376
411
|
return await this.client.checkChecklistItem(chatId, messageId, item);
|
|
377
412
|
}
|
|
378
413
|
/**
|
|
379
414
|
* Context-aware alias for {@link Client.checkChecklistItems}.
|
|
380
415
|
*/
|
|
381
416
|
async checkChecklistItems(messageId, items) {
|
|
382
|
-
const chatId =
|
|
417
|
+
const chatId = this.#mustGetChatId();
|
|
383
418
|
return await this.client.checkChecklistItems(chatId, messageId, items);
|
|
384
419
|
}
|
|
385
420
|
/**
|
|
386
421
|
* Context-aware alias for {@link Client.closeChat}.
|
|
387
422
|
*/
|
|
388
423
|
async close() {
|
|
389
|
-
const chatId =
|
|
424
|
+
const chatId = this.#mustGetChatId();
|
|
390
425
|
return await this.client.closeChat(chatId);
|
|
391
426
|
}
|
|
392
427
|
/**
|
|
393
428
|
* Context-aware alias for {@link Client.closeTopic}.
|
|
394
429
|
*/
|
|
395
430
|
async closeTopic(topicId) {
|
|
396
|
-
const chatId =
|
|
431
|
+
const chatId = this.#mustGetChatId();
|
|
397
432
|
return await this.client.closeTopic(chatId, topicId);
|
|
398
433
|
}
|
|
399
434
|
/**
|
|
400
435
|
* Context-aware alias for {@link Client.createInviteLink}.
|
|
401
436
|
*/
|
|
402
437
|
async createInviteLink(params) {
|
|
403
|
-
const chatId =
|
|
438
|
+
const chatId = this.#mustGetChatId();
|
|
404
439
|
return await this.client.createInviteLink(chatId, params);
|
|
405
440
|
}
|
|
406
441
|
/**
|
|
407
442
|
* Context-aware alias for {@link Client.createStory}.
|
|
408
443
|
*/
|
|
409
444
|
async createStory(content, params) {
|
|
410
|
-
const chatId =
|
|
445
|
+
const chatId = this.#mustGetChatId();
|
|
411
446
|
return await this.client.createStory(chatId, content, params);
|
|
412
447
|
}
|
|
413
448
|
/**
|
|
414
449
|
* Context-aware alias for {@link Client.createTopic}.
|
|
415
450
|
*/
|
|
416
451
|
async createTopic(title, params) {
|
|
417
|
-
const chatId =
|
|
452
|
+
const chatId = this.#mustGetChatId();
|
|
418
453
|
return await this.client.createTopic(chatId, title, params);
|
|
419
454
|
}
|
|
420
455
|
/**
|
|
421
456
|
* Context-aware alias for {@link Client.declineJoinRequest}.
|
|
422
457
|
*/
|
|
423
458
|
async declineJoinRequest() {
|
|
424
|
-
const { chatId, userId } =
|
|
459
|
+
const { chatId, userId } = this.#mustGetMsg();
|
|
425
460
|
if (!userId) {
|
|
426
461
|
unreachable();
|
|
427
462
|
}
|
|
@@ -431,280 +466,280 @@ export class Context {
|
|
|
431
466
|
* Context-aware alias for {@link Client.declineJoinRequests}.
|
|
432
467
|
*/
|
|
433
468
|
async declineJoinRequests(params) {
|
|
434
|
-
const chatId =
|
|
469
|
+
const chatId = this.#mustGetChatId();
|
|
435
470
|
return await this.client.declineJoinRequests(chatId, params);
|
|
436
471
|
}
|
|
437
472
|
/**
|
|
438
473
|
* Context-aware alias for {@link Client.deleteChatPhoto}.
|
|
439
474
|
*/
|
|
440
475
|
async deletChatPhoto() {
|
|
441
|
-
const chatId =
|
|
476
|
+
const chatId = this.#mustGetChatId();
|
|
442
477
|
return await this.client.deleteChatPhoto(chatId);
|
|
443
478
|
}
|
|
444
479
|
/**
|
|
445
480
|
* Context-aware alias for {@link Client.deleteMessage}.
|
|
446
481
|
*/
|
|
447
482
|
async delete() {
|
|
448
|
-
const { chatId, messageId } =
|
|
483
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
449
484
|
return await this.client.deleteMessage(chatId, messageId);
|
|
450
485
|
}
|
|
451
486
|
/**
|
|
452
487
|
* Context-aware alias for {@link Client.deleteChat}.
|
|
453
488
|
*/
|
|
454
489
|
async deleteChat() {
|
|
455
|
-
const chatId =
|
|
490
|
+
const chatId = this.#mustGetChatId();
|
|
456
491
|
return await this.client.deleteChat(chatId);
|
|
457
492
|
}
|
|
458
493
|
/**
|
|
459
494
|
* Context-aware alias for {@link Client.deleteChatMemberMessages}.
|
|
460
495
|
*/
|
|
461
496
|
async deleteChatMemberMessages(userId) {
|
|
462
|
-
const chatId =
|
|
497
|
+
const chatId = this.#mustGetChatId();
|
|
463
498
|
return await this.client.deleteChatMemberMessages(chatId, userId);
|
|
464
499
|
}
|
|
465
500
|
/**
|
|
466
501
|
* Context-aware alias for {@link Client.deleteChatStickerSet}.
|
|
467
502
|
*/
|
|
468
503
|
async deleteChatStickerSet() {
|
|
469
|
-
const chatId =
|
|
504
|
+
const chatId = this.#mustGetChatId();
|
|
470
505
|
return await this.client.deleteChatStickerSet(chatId);
|
|
471
506
|
}
|
|
472
507
|
/**
|
|
473
508
|
* Context-aware alias for {@link Client.deleteMessage}.
|
|
474
509
|
*/
|
|
475
510
|
async deleteMessage(messageId, params) {
|
|
476
|
-
const chatId =
|
|
511
|
+
const chatId = this.#mustGetChatId();
|
|
477
512
|
return await this.client.deleteMessage(chatId, messageId, params);
|
|
478
513
|
}
|
|
479
514
|
/**
|
|
480
515
|
* Context-aware alias for {@link Client.deleteMessages}.
|
|
481
516
|
*/
|
|
482
517
|
async deleteMessages(messageIds, params) {
|
|
483
|
-
const chatId =
|
|
518
|
+
const chatId = this.#mustGetChatId();
|
|
484
519
|
return await this.client.deleteMessages(chatId, messageIds, params);
|
|
485
520
|
}
|
|
486
521
|
/**
|
|
487
522
|
* Context-aware alias for {@link Client.deleteScheduledMessage}.
|
|
488
523
|
*/
|
|
489
524
|
async deleteScheduledMessage(messageId) {
|
|
490
|
-
const chatId =
|
|
525
|
+
const chatId = this.#mustGetChatId();
|
|
491
526
|
return await this.client.deleteScheduledMessage(chatId, messageId);
|
|
492
527
|
}
|
|
493
528
|
/**
|
|
494
529
|
* Context-aware alias for {@link Client.deleteScheduledMessages}.
|
|
495
530
|
*/
|
|
496
531
|
async deleteScheduledMessages(messageIds) {
|
|
497
|
-
const chatId =
|
|
532
|
+
const chatId = this.#mustGetChatId();
|
|
498
533
|
return await this.client.deleteScheduledMessages(chatId, messageIds);
|
|
499
534
|
}
|
|
500
535
|
/**
|
|
501
536
|
* Context-aware alias for {@link Client.deleteStories}.
|
|
502
537
|
*/
|
|
503
538
|
async deleteStories(storyIds) {
|
|
504
|
-
const chatId =
|
|
539
|
+
const chatId = this.#mustGetChatId();
|
|
505
540
|
return await this.client.deleteStories(chatId, storyIds);
|
|
506
541
|
}
|
|
507
542
|
/**
|
|
508
543
|
* Context-aware alias for {@link Client.deleteStory}.
|
|
509
544
|
*/
|
|
510
545
|
async deleteStory(storyId) {
|
|
511
|
-
const chatId =
|
|
546
|
+
const chatId = this.#mustGetChatId();
|
|
512
547
|
return await this.client.deleteStory(chatId, storyId);
|
|
513
548
|
}
|
|
514
549
|
/**
|
|
515
550
|
* Context-aware alias for {@link Client.disableAntispam}.
|
|
516
551
|
*/
|
|
517
552
|
async disableAntispam() {
|
|
518
|
-
const chatId =
|
|
553
|
+
const chatId = this.#mustGetChatId();
|
|
519
554
|
return await this.client.disableAntispam(chatId);
|
|
520
555
|
}
|
|
521
556
|
/**
|
|
522
557
|
* Context-aware alias for {@link Client.disableBusinessBots}.
|
|
523
558
|
*/
|
|
524
559
|
async disableBusinessBots() {
|
|
525
|
-
const chatId =
|
|
560
|
+
const chatId = this.#mustGetChatId();
|
|
526
561
|
return await this.client.disableBusinessBots(chatId);
|
|
527
562
|
}
|
|
528
563
|
/**
|
|
529
564
|
* Context-aware alias for {@link Client.disableJoinRequests}.
|
|
530
565
|
*/
|
|
531
566
|
async disableJoinRequests() {
|
|
532
|
-
const chatId =
|
|
567
|
+
const chatId = this.#mustGetChatId();
|
|
533
568
|
return await this.client.disableJoinRequests(chatId);
|
|
534
569
|
}
|
|
535
570
|
/**
|
|
536
571
|
* Context-aware alias for {@link Client.disableSharing}.
|
|
537
572
|
*/
|
|
538
573
|
async disableSharing() {
|
|
539
|
-
const chatId =
|
|
574
|
+
const chatId = this.#mustGetChatId();
|
|
540
575
|
return await this.client.disableSharing(chatId);
|
|
541
576
|
}
|
|
542
577
|
/**
|
|
543
578
|
* Context-aware alias for {@link Client.disableSignatures}.
|
|
544
579
|
*/
|
|
545
580
|
async disableSignatures() {
|
|
546
|
-
const chatId =
|
|
581
|
+
const chatId = this.#mustGetChatId();
|
|
547
582
|
return await this.client.disableSignatures(chatId);
|
|
548
583
|
}
|
|
549
584
|
/**
|
|
550
585
|
* Context-aware alias for {@link Client.disableSlowMode}.
|
|
551
586
|
*/
|
|
552
587
|
async disableSlowMode() {
|
|
553
|
-
const chatId =
|
|
588
|
+
const chatId = this.#mustGetChatId();
|
|
554
589
|
return await this.client.disableSlowMode(chatId);
|
|
555
590
|
}
|
|
556
591
|
/**
|
|
557
592
|
* Context-aware alias for {@link Client.disableTopics}.
|
|
558
593
|
*/
|
|
559
594
|
async disableTopics() {
|
|
560
|
-
const chatId =
|
|
595
|
+
const chatId = this.#mustGetChatId();
|
|
561
596
|
return await this.client.disableTopics(chatId);
|
|
562
597
|
}
|
|
563
598
|
/**
|
|
564
599
|
* Context-aware alias for {@link Client.editInlineMessageCaption}.
|
|
565
600
|
*/
|
|
566
601
|
async editInlineMessageCaption(params) {
|
|
567
|
-
const inlineMessageId =
|
|
602
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
568
603
|
return await this.client.editInlineMessageCaption(inlineMessageId, params);
|
|
569
604
|
}
|
|
570
605
|
/**
|
|
571
606
|
* Context-aware alias for {@link Client.editInlineMessageLiveLocation}.
|
|
572
607
|
*/
|
|
573
608
|
async editInlineMessageLiveLocation(latitude, longitude, params) {
|
|
574
|
-
const inlineMessageId =
|
|
609
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
575
610
|
return await this.client.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
|
|
576
611
|
}
|
|
577
612
|
/**
|
|
578
613
|
* Context-aware alias for {@link Client.editInlineMessageMedia}.
|
|
579
614
|
*/
|
|
580
615
|
async editInlineMessageMedia(media, params) {
|
|
581
|
-
const inlineMessageId =
|
|
616
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
582
617
|
return await this.client.editInlineMessageMedia(inlineMessageId, media, params);
|
|
583
618
|
}
|
|
584
619
|
/**
|
|
585
620
|
* Context-aware alias for {@link Client.editInlineMessageReplyMarkup}.
|
|
586
621
|
*/
|
|
587
622
|
async editInlineMessageReplyMarkup(params) {
|
|
588
|
-
const inlineMessageId =
|
|
623
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
589
624
|
return await this.client.editInlineMessageReplyMarkup(inlineMessageId, params);
|
|
590
625
|
}
|
|
591
626
|
/**
|
|
592
627
|
* Context-aware alias for {@link Client.editInlineMessageText}.
|
|
593
628
|
*/
|
|
594
629
|
async editInlineMessageText(text, params) {
|
|
595
|
-
const inlineMessageId =
|
|
630
|
+
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
596
631
|
return await this.client.editInlineMessageText(inlineMessageId, text, params);
|
|
597
632
|
}
|
|
598
633
|
/**
|
|
599
634
|
* Context-aware alias for {@link Client.editMessageCaption}.
|
|
600
635
|
*/
|
|
601
636
|
async editMessageCaption(messageId, params) {
|
|
602
|
-
const chatId =
|
|
637
|
+
const chatId = this.#mustGetChatId();
|
|
603
638
|
return await this.client.editMessageCaption(chatId, messageId, params);
|
|
604
639
|
}
|
|
605
640
|
/**
|
|
606
641
|
* Context-aware alias for {@link Client.editMessageLiveLocation}.
|
|
607
642
|
*/
|
|
608
643
|
async editMessageLiveLocation(messageId, latitude, longitude, params) {
|
|
609
|
-
const chatId =
|
|
644
|
+
const chatId = this.#mustGetChatId();
|
|
610
645
|
return await this.client.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
|
|
611
646
|
}
|
|
612
647
|
/**
|
|
613
648
|
* Context-aware alias for {@link Client.editMessageMedia}.
|
|
614
649
|
*/
|
|
615
650
|
async editMessageMedia(messageId, media, params) {
|
|
616
|
-
const chatId =
|
|
651
|
+
const chatId = this.#mustGetChatId();
|
|
617
652
|
return await this.client.editMessageMedia(chatId, messageId, media, params);
|
|
618
653
|
}
|
|
619
654
|
/**
|
|
620
655
|
* Context-aware alias for {@link Client.editMessageReplyMarkup}.
|
|
621
656
|
*/
|
|
622
657
|
async editMessageReplyMarkup(messageId, params) {
|
|
623
|
-
const chatId =
|
|
658
|
+
const chatId = this.#mustGetChatId();
|
|
624
659
|
return await this.client.editMessageReplyMarkup(chatId, messageId, params);
|
|
625
660
|
}
|
|
626
661
|
/**
|
|
627
662
|
* Context-aware alias for {@link Client.editMessageText}.
|
|
628
663
|
*/
|
|
629
664
|
async editMessageText(messageId, text, params) {
|
|
630
|
-
const chatId =
|
|
665
|
+
const chatId = this.#mustGetChatId();
|
|
631
666
|
return await this.client.editMessageText(chatId, messageId, text, params);
|
|
632
667
|
}
|
|
633
668
|
/**
|
|
634
669
|
* Context-aware alias for {@link Client.editTopic}.
|
|
635
670
|
*/
|
|
636
671
|
async editTopic(topicId, title, params) {
|
|
637
|
-
const chatId =
|
|
672
|
+
const chatId = this.#mustGetChatId();
|
|
638
673
|
return await this.client.editTopic(chatId, topicId, title, params);
|
|
639
674
|
}
|
|
640
675
|
/**
|
|
641
676
|
* Context-aware alias for {@link Client.enableAntispam}.
|
|
642
677
|
*/
|
|
643
678
|
async enableAntispam() {
|
|
644
|
-
const chatId =
|
|
679
|
+
const chatId = this.#mustGetChatId();
|
|
645
680
|
return await this.client.enableAntispam(chatId);
|
|
646
681
|
}
|
|
647
682
|
/**
|
|
648
683
|
* Context-aware alias for {@link Client.enableBusinessBots}.
|
|
649
684
|
*/
|
|
650
685
|
async enableBusinessBots() {
|
|
651
|
-
const chatId =
|
|
686
|
+
const chatId = this.#mustGetChatId();
|
|
652
687
|
return await this.client.enableBusinessBots(chatId);
|
|
653
688
|
}
|
|
654
689
|
/**
|
|
655
690
|
* Context-aware alias for {@link Client.enableJoinRequests}.
|
|
656
691
|
*/
|
|
657
692
|
async enableJoinRequests() {
|
|
658
|
-
const chatId =
|
|
693
|
+
const chatId = this.#mustGetChatId();
|
|
659
694
|
return await this.client.enableJoinRequests(chatId);
|
|
660
695
|
}
|
|
661
696
|
/**
|
|
662
697
|
* Context-aware alias for {@link Client.enableSharing}.
|
|
663
698
|
*/
|
|
664
699
|
async enableSharing() {
|
|
665
|
-
const chatId =
|
|
700
|
+
const chatId = this.#mustGetChatId();
|
|
666
701
|
return await this.client.enableSharing(chatId);
|
|
667
702
|
}
|
|
668
703
|
/**
|
|
669
704
|
* Context-aware alias for {@link Client.enableSignatures}.
|
|
670
705
|
*/
|
|
671
706
|
async enableSignatures(params) {
|
|
672
|
-
const chatId =
|
|
707
|
+
const chatId = this.#mustGetChatId();
|
|
673
708
|
return await this.client.enableSignatures(chatId, params);
|
|
674
709
|
}
|
|
675
710
|
/**
|
|
676
711
|
* Context-aware alias for {@link Client.enableTopics}.
|
|
677
712
|
*/
|
|
678
713
|
async enableTopics(isShownAsTabs) {
|
|
679
|
-
const chatId =
|
|
714
|
+
const chatId = this.#mustGetChatId();
|
|
680
715
|
return await this.client.enableTopics(chatId, isShownAsTabs);
|
|
681
716
|
}
|
|
682
717
|
/**
|
|
683
718
|
* Context-aware alias for {@link Client.forwardMessage}.
|
|
684
719
|
*/
|
|
685
720
|
async forward(to, params) {
|
|
686
|
-
const { chatId, messageId } =
|
|
721
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
687
722
|
return await this.client.forwardMessage(chatId, to, messageId, params);
|
|
688
723
|
}
|
|
689
724
|
/**
|
|
690
725
|
* Context-aware alias for {@link Client.forwardMessage}.
|
|
691
726
|
*/
|
|
692
727
|
async forwardMessage(to, messageId, params) {
|
|
693
|
-
const chatId =
|
|
728
|
+
const chatId = this.#mustGetChatId();
|
|
694
729
|
return await this.client.forwardMessage(chatId, to, messageId, params);
|
|
695
730
|
}
|
|
696
731
|
/**
|
|
697
732
|
* Context-aware alias for {@link Client.forwardMessages}.
|
|
698
733
|
*/
|
|
699
734
|
async forwardMessages(to, messageIds, params) {
|
|
700
|
-
const chatId =
|
|
735
|
+
const chatId = this.#mustGetChatId();
|
|
701
736
|
return await this.client.forwardMessages(chatId, to, messageIds, params);
|
|
702
737
|
}
|
|
703
738
|
/**
|
|
704
739
|
* Context-aware alias for {@link Client.getBusinessConnection}.
|
|
705
740
|
*/
|
|
706
741
|
async getBusinessConnection() {
|
|
707
|
-
const { businessConnectionId } =
|
|
742
|
+
const { businessConnectionId } = this.#mustGetMsg();
|
|
708
743
|
if (!businessConnectionId) {
|
|
709
744
|
unreachable();
|
|
710
745
|
}
|
|
@@ -714,161 +749,161 @@ export class Context {
|
|
|
714
749
|
* Context-aware alias for {@link Client.getChat}.
|
|
715
750
|
*/
|
|
716
751
|
async getChat() {
|
|
717
|
-
const chatId =
|
|
752
|
+
const chatId = this.#mustGetChatId();
|
|
718
753
|
return await this.client.getChat(chatId);
|
|
719
754
|
}
|
|
720
755
|
/**
|
|
721
756
|
* Context-aware alias for {@link Client.getChatAdministrators}.
|
|
722
757
|
*/
|
|
723
758
|
async getChatAdministrators() {
|
|
724
|
-
const chatId =
|
|
759
|
+
const chatId = this.#mustGetChatId();
|
|
725
760
|
return await this.client.getChatAdministrators(chatId);
|
|
726
761
|
}
|
|
727
762
|
/**
|
|
728
763
|
* Context-aware alias for {@link Client.getChatMember}.
|
|
729
764
|
*/
|
|
730
765
|
async getChatMember(userId) {
|
|
731
|
-
const chatId =
|
|
766
|
+
const chatId = this.#mustGetChatId();
|
|
732
767
|
return await this.client.getChatMember(chatId, userId);
|
|
733
768
|
}
|
|
734
769
|
/**
|
|
735
770
|
* Context-aware alias for {@link Client.getChatMembers}.
|
|
736
771
|
*/
|
|
737
772
|
async getChatMembers(params) {
|
|
738
|
-
const chatId =
|
|
773
|
+
const chatId = this.#mustGetChatId();
|
|
739
774
|
return await this.client.getChatMembers(chatId, params);
|
|
740
775
|
}
|
|
741
776
|
/**
|
|
742
777
|
* Context-aware alias for {@link Client.getChatSettings}.
|
|
743
778
|
*/
|
|
744
779
|
async getChatSettings() {
|
|
745
|
-
const chatId =
|
|
780
|
+
const chatId = this.#mustGetChatId();
|
|
746
781
|
return await this.client.getChatSettings(chatId);
|
|
747
782
|
}
|
|
748
783
|
/**
|
|
749
784
|
* Context-aware alias for {@link Client.getClaimedGifts}.
|
|
750
785
|
*/
|
|
751
786
|
async getClaimedGifts(params) {
|
|
752
|
-
const chatId =
|
|
787
|
+
const chatId = this.#mustGetChatId();
|
|
753
788
|
return await this.client.getClaimedGifts(chatId, params);
|
|
754
789
|
}
|
|
755
790
|
/**
|
|
756
791
|
* Context-aware alias for {@link Client.getChatSettings}.
|
|
757
792
|
*/
|
|
758
793
|
async getCommonChats() {
|
|
759
|
-
const chatId =
|
|
794
|
+
const chatId = this.#mustGetChatId();
|
|
760
795
|
return await this.client.getCommonChats(chatId);
|
|
761
796
|
}
|
|
762
797
|
/**
|
|
763
798
|
* Context-aware alias for {@link Client.getCreatedInviteLinks}.
|
|
764
799
|
*/
|
|
765
800
|
async getCreatedInviteLinks(params) {
|
|
766
|
-
const chatId =
|
|
801
|
+
const chatId = this.#mustGetChatId();
|
|
767
802
|
return await this.client.getCreatedInviteLinks(chatId, params);
|
|
768
803
|
}
|
|
769
804
|
/**
|
|
770
805
|
* Context-aware alias for {@link Client.getHistory}.
|
|
771
806
|
*/
|
|
772
807
|
async getHistory(params) {
|
|
773
|
-
const chatId =
|
|
808
|
+
const chatId = this.#mustGetChatId();
|
|
774
809
|
return await this.client.getHistory(chatId, params);
|
|
775
810
|
}
|
|
776
811
|
/**
|
|
777
812
|
* Context-aware alias for {@link Client.getJoinRequests}.
|
|
778
813
|
*/
|
|
779
814
|
async getJoinRequests(params) {
|
|
780
|
-
const chatId =
|
|
815
|
+
const chatId = this.#mustGetChatId();
|
|
781
816
|
return await this.client.getJoinRequests(chatId, params);
|
|
782
817
|
}
|
|
783
818
|
/**
|
|
784
819
|
* Context-aware alias for {@link Client.getMessage}.
|
|
785
820
|
*/
|
|
786
821
|
async getMessage(messageId) {
|
|
787
|
-
const chatId =
|
|
822
|
+
const chatId = this.#mustGetChatId();
|
|
788
823
|
return await this.client.getMessage(chatId, messageId);
|
|
789
824
|
}
|
|
790
825
|
/**
|
|
791
826
|
* Context-aware alias for {@link Client.getMessageReactions}.
|
|
792
827
|
*/
|
|
793
828
|
async getMessageReactions(messageId) {
|
|
794
|
-
const chatId =
|
|
829
|
+
const chatId = this.#mustGetChatId();
|
|
795
830
|
return await this.client.getMessageReactions(chatId, messageId);
|
|
796
831
|
}
|
|
797
832
|
/**
|
|
798
833
|
* Context-aware alias for {@link Client.getMessages}.
|
|
799
834
|
*/
|
|
800
835
|
async getMessages(messageIds) {
|
|
801
|
-
const chatId =
|
|
836
|
+
const chatId = this.#mustGetChatId();
|
|
802
837
|
return await this.client.getMessages(chatId, messageIds);
|
|
803
838
|
}
|
|
804
839
|
/**
|
|
805
840
|
* Context-aware alias for {@link Client.getSavedMessages}.
|
|
806
841
|
*/
|
|
807
842
|
async getSavedMessages(params) {
|
|
808
|
-
const chatId =
|
|
843
|
+
const chatId = this.#mustGetChatId();
|
|
809
844
|
return await this.client.getSavedMessages(chatId, params);
|
|
810
845
|
}
|
|
811
846
|
/**
|
|
812
847
|
* Context-aware alias for {@link Client.getSimilarBots}.
|
|
813
848
|
*/
|
|
814
849
|
async getSimilarBots() {
|
|
815
|
-
const chatId =
|
|
850
|
+
const chatId = this.#mustGetChatId();
|
|
816
851
|
return await this.client.getSimilarBots(chatId);
|
|
817
852
|
}
|
|
818
853
|
/**
|
|
819
854
|
* Context-aware alias for {@link Client.getSimilarChannels}.
|
|
820
855
|
*/
|
|
821
856
|
async getSimilarChannels() {
|
|
822
|
-
const chatId =
|
|
857
|
+
const chatId = this.#mustGetChatId();
|
|
823
858
|
return await this.client.getSimilarChannels(chatId);
|
|
824
859
|
}
|
|
825
860
|
/**
|
|
826
861
|
* Context-aware alias for {@link Client.getStories}.
|
|
827
862
|
*/
|
|
828
863
|
async getStories(storyIds) {
|
|
829
|
-
const chatId =
|
|
864
|
+
const chatId = this.#mustGetChatId();
|
|
830
865
|
return await this.client.getStories(chatId, storyIds);
|
|
831
866
|
}
|
|
832
867
|
/**
|
|
833
868
|
* Context-aware alias for {@link Client.getStory}.
|
|
834
869
|
*/
|
|
835
870
|
async getStory(storyId) {
|
|
836
|
-
const chatId =
|
|
871
|
+
const chatId = this.#mustGetChatId();
|
|
837
872
|
return await this.client.getStory(chatId, storyId);
|
|
838
873
|
}
|
|
839
874
|
/**
|
|
840
875
|
* Context-aware alias for {@link Client.sendGift}.
|
|
841
876
|
*/
|
|
842
877
|
async gift(giftId, params) {
|
|
843
|
-
const chatId =
|
|
878
|
+
const chatId = this.#mustGetChatId();
|
|
844
879
|
return await this.client.sendGift(chatId, giftId, params);
|
|
845
880
|
}
|
|
846
881
|
/**
|
|
847
882
|
* Context-aware alias for {@link Client.hideGeneralTopic}.
|
|
848
883
|
*/
|
|
849
884
|
async hideGeneralTopic() {
|
|
850
|
-
const chatId =
|
|
885
|
+
const chatId = this.#mustGetChatId();
|
|
851
886
|
return await this.client.hideGeneralTopic(chatId);
|
|
852
887
|
}
|
|
853
888
|
/**
|
|
854
889
|
* Context-aware alias for {@link Client.hideMemberList}.
|
|
855
890
|
*/
|
|
856
891
|
async hideMemberList() {
|
|
857
|
-
const chatId =
|
|
892
|
+
const chatId = this.#mustGetChatId();
|
|
858
893
|
return await this.client.hideMemberList(chatId);
|
|
859
894
|
}
|
|
860
895
|
/**
|
|
861
896
|
* Context-aware alias for {@link Client.kickChatMember}.
|
|
862
897
|
*/
|
|
863
898
|
async kickChatMember(memberId) {
|
|
864
|
-
const chatId =
|
|
899
|
+
const chatId = this.#mustGetChatId();
|
|
865
900
|
return await this.client.kickChatMember(chatId, memberId);
|
|
866
901
|
}
|
|
867
902
|
/**
|
|
868
903
|
* Context-aware alias for {@link Client.kickChatMember}.
|
|
869
904
|
*/
|
|
870
905
|
async kickSender() {
|
|
871
|
-
const { chatId, senderId } =
|
|
906
|
+
const { chatId, senderId } = this.#mustGetMsg();
|
|
872
907
|
if (!senderId) {
|
|
873
908
|
unreachable();
|
|
874
909
|
}
|
|
@@ -878,270 +913,270 @@ export class Context {
|
|
|
878
913
|
* Context-aware alias for {@link Client.leaveChat}.
|
|
879
914
|
*/
|
|
880
915
|
async leaveChat() {
|
|
881
|
-
const chatId =
|
|
916
|
+
const chatId = this.#mustGetChatId();
|
|
882
917
|
return await this.client.leaveChat(chatId);
|
|
883
918
|
}
|
|
884
919
|
/**
|
|
885
920
|
* Context-aware alias for {@link Client.openChat}.
|
|
886
921
|
*/
|
|
887
922
|
async open() {
|
|
888
|
-
const chatId =
|
|
923
|
+
const chatId = this.#mustGetChatId();
|
|
889
924
|
return await this.client.openChat(chatId);
|
|
890
925
|
}
|
|
891
926
|
/**
|
|
892
927
|
* Context-aware alias for {@link Client.pauseBusinessBotConnection}.
|
|
893
928
|
*/
|
|
894
929
|
async pauseBusinessBotConnection() {
|
|
895
|
-
const chatId =
|
|
930
|
+
const chatId = this.#mustGetChatId();
|
|
896
931
|
return await this.client.pauseBusinessBotConnection(chatId);
|
|
897
932
|
}
|
|
898
933
|
/**
|
|
899
934
|
* Context-aware alias for {@link Client.pinMessage}.
|
|
900
935
|
*/
|
|
901
936
|
async pin(params) {
|
|
902
|
-
const { chatId, messageId, businessConnectionId } =
|
|
937
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
903
938
|
return await this.client.pinMessage(chatId, messageId, { ...params, businessConnectionId });
|
|
904
939
|
}
|
|
905
940
|
/**
|
|
906
941
|
* Context-aware alias for {@link Client.pinMessage}.
|
|
907
942
|
*/
|
|
908
943
|
async pinMessage(messageId, params) {
|
|
909
|
-
const chatId =
|
|
944
|
+
const chatId = this.#mustGetChatId();
|
|
910
945
|
return await this.client.pinMessage(chatId, messageId, params);
|
|
911
946
|
}
|
|
912
947
|
/**
|
|
913
948
|
* Context-aware alias for {@link Client.pinTopic}.
|
|
914
949
|
*/
|
|
915
950
|
async pinTopic(topicId) {
|
|
916
|
-
const chatId =
|
|
951
|
+
const chatId = this.#mustGetChatId();
|
|
917
952
|
return await this.client.pinTopic(chatId, topicId);
|
|
918
953
|
}
|
|
919
954
|
/**
|
|
920
955
|
* Context-aware alias for {@link Client.promoteChatMember}.
|
|
921
956
|
*/
|
|
922
957
|
async promoteChatMember(userId, params) {
|
|
923
|
-
const chatId =
|
|
958
|
+
const chatId = this.#mustGetChatId();
|
|
924
959
|
return await this.client.promoteChatMember(chatId, userId, params);
|
|
925
960
|
}
|
|
926
961
|
/**
|
|
927
962
|
* Context-aware alias for {@link Client.setReactions}.
|
|
928
963
|
*/
|
|
929
964
|
async react(reactions, params) {
|
|
930
|
-
const { chatId, messageId } =
|
|
965
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
931
966
|
return await this.client.setReactions(chatId, messageId, reactions, params);
|
|
932
967
|
}
|
|
933
968
|
/**
|
|
934
969
|
* Context-aware alias for {@link Client.readMessages}.
|
|
935
970
|
*/
|
|
936
971
|
async read() {
|
|
937
|
-
const { chatId, messageId } =
|
|
972
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
938
973
|
return await this.client.readMessages(chatId, messageId);
|
|
939
974
|
}
|
|
940
975
|
/**
|
|
941
976
|
* Context-aware alias for {@link Client.refundStarPayment}.
|
|
942
977
|
*/
|
|
943
978
|
async refundStarPayment(telegramPaymentChargeId) {
|
|
944
|
-
const chatId =
|
|
979
|
+
const chatId = this.#mustGetChatId();
|
|
945
980
|
return await this.client.refundStarPayment(chatId, telegramPaymentChargeId);
|
|
946
981
|
}
|
|
947
982
|
/**
|
|
948
983
|
* Context-aware alias for {@link Client.deleteContact}.
|
|
949
984
|
*/
|
|
950
985
|
async removeAsContact() {
|
|
951
|
-
const chatId =
|
|
986
|
+
const chatId = this.#mustGetChatId();
|
|
952
987
|
return await this.client.deleteContact(chatId);
|
|
953
988
|
}
|
|
954
989
|
/**
|
|
955
990
|
* Context-aware alias for {@link Client.removeReaction}.
|
|
956
991
|
*/
|
|
957
992
|
async removeReaction(messageId, reaction) {
|
|
958
|
-
const chatId =
|
|
993
|
+
const chatId = this.#mustGetChatId();
|
|
959
994
|
return await this.client.removeReaction(chatId, messageId, reaction);
|
|
960
995
|
}
|
|
961
996
|
/**
|
|
962
997
|
* Context-aware alias for {@link Client.removeStoriesFromHighlights}.
|
|
963
998
|
*/
|
|
964
999
|
async removeStoriesFromHighlights(storyIds) {
|
|
965
|
-
const chatId =
|
|
1000
|
+
const chatId = this.#mustGetChatId();
|
|
966
1001
|
return await this.client.removeStoriesFromHighlights(chatId, storyIds);
|
|
967
1002
|
}
|
|
968
1003
|
/**
|
|
969
1004
|
* Context-aware alias for {@link Client.removeStoryFromHighlights}.
|
|
970
1005
|
*/
|
|
971
1006
|
async removeStoryFromHighlights(storyId) {
|
|
972
|
-
const chatId =
|
|
1007
|
+
const chatId = this.#mustGetChatId();
|
|
973
1008
|
return await this.client.removeStoryFromHighlights(chatId, storyId);
|
|
974
1009
|
}
|
|
975
1010
|
/**
|
|
976
1011
|
* Context-aware alias for {@link Client.reopenTopic}.
|
|
977
1012
|
*/
|
|
978
1013
|
async reopenTopic(topicId) {
|
|
979
|
-
const chatId =
|
|
1014
|
+
const chatId = this.#mustGetChatId();
|
|
980
1015
|
return await this.client.reopenTopic(chatId, topicId);
|
|
981
1016
|
}
|
|
982
1017
|
/**
|
|
983
1018
|
* Context-aware alias for {@link Client.sendMessage}.
|
|
984
1019
|
*/
|
|
985
1020
|
async reply(text, params) {
|
|
986
|
-
const { chatId, messageId, businessConnectionId } =
|
|
987
|
-
const replyTo =
|
|
1021
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1022
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
988
1023
|
return await this.client.sendMessage(chatId, text, { ...params, ...replyTo, businessConnectionId });
|
|
989
1024
|
}
|
|
990
1025
|
/**
|
|
991
1026
|
* Context-aware alias for {@link Client.sendAnimation}.
|
|
992
1027
|
*/
|
|
993
1028
|
async replyAnimation(animation, params) {
|
|
994
|
-
const { chatId, messageId, businessConnectionId } =
|
|
995
|
-
const replyTo =
|
|
1029
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1030
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
996
1031
|
return await this.client.sendAnimation(chatId, animation, { ...params, ...replyTo, businessConnectionId });
|
|
997
1032
|
}
|
|
998
1033
|
/**
|
|
999
1034
|
* Context-aware alias for {@link Client.sendAudio}.
|
|
1000
1035
|
*/
|
|
1001
1036
|
async replyAudio(audio, params) {
|
|
1002
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1003
|
-
const replyTo =
|
|
1037
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1038
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1004
1039
|
return await this.client.sendAudio(chatId, audio, { ...params, ...replyTo, businessConnectionId });
|
|
1005
1040
|
}
|
|
1006
1041
|
/**
|
|
1007
1042
|
* Context-aware alias for {@link Client.sendChecklist}.
|
|
1008
1043
|
*/
|
|
1009
1044
|
async replyChecklist(title, items, params) {
|
|
1010
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1011
|
-
const replyTo =
|
|
1045
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1046
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1012
1047
|
return await this.client.sendChecklist(chatId, title, items, { ...params, ...replyTo, businessConnectionId });
|
|
1013
1048
|
}
|
|
1014
1049
|
/**
|
|
1015
1050
|
* Context-aware alias for {@link Client.sendContact}.
|
|
1016
1051
|
*/
|
|
1017
1052
|
async replyContact(firstName, number, params) {
|
|
1018
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1019
|
-
const replyTo =
|
|
1053
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1054
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1020
1055
|
return await this.client.sendContact(chatId, firstName, number, { ...params, ...replyTo, businessConnectionId });
|
|
1021
1056
|
}
|
|
1022
1057
|
/**
|
|
1023
1058
|
* Context-aware alias for {@link Client.sendDice}.
|
|
1024
1059
|
*/
|
|
1025
1060
|
async replyDice(params) {
|
|
1026
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1027
|
-
const replyTo =
|
|
1061
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1062
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1028
1063
|
return await this.client.sendDice(chatId, { ...params, ...replyTo, businessConnectionId });
|
|
1029
1064
|
}
|
|
1030
1065
|
/**
|
|
1031
1066
|
* Context-aware alias for {@link Client.sendDocument}.
|
|
1032
1067
|
*/
|
|
1033
1068
|
async replyDocument(document, params) {
|
|
1034
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1035
|
-
const replyTo =
|
|
1069
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1070
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1036
1071
|
return await this.client.sendDocument(chatId, document, { ...params, ...replyTo, businessConnectionId });
|
|
1037
1072
|
}
|
|
1038
1073
|
/**
|
|
1039
1074
|
* Context-aware alias for {@link Client.sendMessageDraft}.
|
|
1040
1075
|
*/
|
|
1041
1076
|
async replyDraft(draftId, text, params) {
|
|
1042
|
-
const { chatId, messageId } =
|
|
1043
|
-
const replyTo =
|
|
1077
|
+
const { chatId, messageId } = this.#mustGetMsg();
|
|
1078
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1044
1079
|
return await this.client.sendMessageDraft(chatId, draftId, text, { ...params, ...replyTo });
|
|
1045
1080
|
}
|
|
1046
1081
|
/**
|
|
1047
1082
|
* Context-aware alias for {@link Client.sendInvoice}.
|
|
1048
1083
|
*/
|
|
1049
1084
|
async replyInvoice(title, description, payload, currency, prices, params) {
|
|
1050
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1051
|
-
const replyTo =
|
|
1085
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1086
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1052
1087
|
return await this.client.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, ...replyTo, businessConnectionId });
|
|
1053
1088
|
}
|
|
1054
1089
|
/**
|
|
1055
1090
|
* Context-aware alias for {@link Client.sendLocation}.
|
|
1056
1091
|
*/
|
|
1057
1092
|
async replyLocation(latitude, longitude, params) {
|
|
1058
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1059
|
-
const replyTo =
|
|
1093
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1094
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1060
1095
|
return await this.client.sendLocation(chatId, latitude, longitude, { ...params, ...replyTo, businessConnectionId });
|
|
1061
1096
|
}
|
|
1062
1097
|
/**
|
|
1063
1098
|
* Context-aware alias for {@link Client.sendMediaGroup}.
|
|
1064
1099
|
*/
|
|
1065
1100
|
async replyMediaGroup(media, params) {
|
|
1066
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1067
|
-
const replyTo =
|
|
1101
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1102
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1068
1103
|
return await this.client.sendMediaGroup(chatId, media, { ...params, ...replyTo, businessConnectionId });
|
|
1069
1104
|
}
|
|
1070
1105
|
/**
|
|
1071
1106
|
* Context-aware alias for {@link Client.sendPhoto}.
|
|
1072
1107
|
*/
|
|
1073
1108
|
async replyPhoto(photo, params) {
|
|
1074
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1075
|
-
const replyTo =
|
|
1109
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1110
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1076
1111
|
return await this.client.sendPhoto(chatId, photo, { ...params, ...replyTo, businessConnectionId });
|
|
1077
1112
|
}
|
|
1078
1113
|
/**
|
|
1079
1114
|
* Context-aware alias for {@link Client.sendPoll}.
|
|
1080
1115
|
*/
|
|
1081
1116
|
async replyPoll(question, options, params) {
|
|
1082
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1083
|
-
const replyTo =
|
|
1117
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1118
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1084
1119
|
return await this.client.sendPoll(chatId, question, options, { ...params, ...replyTo, businessConnectionId });
|
|
1085
1120
|
}
|
|
1086
1121
|
/**
|
|
1087
1122
|
* Context-aware alias for {@link Client.sendSticker}.
|
|
1088
1123
|
*/
|
|
1089
1124
|
async replySticker(sticker, params) {
|
|
1090
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1091
|
-
const replyTo =
|
|
1125
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1126
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1092
1127
|
return await this.client.sendSticker(chatId, sticker, { ...params, ...replyTo, businessConnectionId });
|
|
1093
1128
|
}
|
|
1094
1129
|
/**
|
|
1095
1130
|
* Context-aware alias for {@link Client.sendVenue}.
|
|
1096
1131
|
*/
|
|
1097
1132
|
async replyVenue(latitude, longitude, title, address, params) {
|
|
1098
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1099
|
-
const replyTo =
|
|
1133
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1134
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1100
1135
|
return await this.client.sendVenue(chatId, latitude, longitude, title, address, { ...params, ...replyTo, businessConnectionId });
|
|
1101
1136
|
}
|
|
1102
1137
|
/**
|
|
1103
1138
|
* Context-aware alias for {@link Client.sendVideo}.
|
|
1104
1139
|
*/
|
|
1105
1140
|
async replyVideo(video, params) {
|
|
1106
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1107
|
-
const replyTo =
|
|
1141
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1142
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1108
1143
|
return await this.client.sendVideo(chatId, video, { ...params, ...replyTo, businessConnectionId });
|
|
1109
1144
|
}
|
|
1110
1145
|
/**
|
|
1111
1146
|
* Context-aware alias for {@link Client.sendVideoNote}.
|
|
1112
1147
|
*/
|
|
1113
1148
|
async replyVideoNote(videoNote, params) {
|
|
1114
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1115
|
-
const replyTo =
|
|
1149
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1150
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1116
1151
|
return await this.client.sendVideoNote(chatId, videoNote, { ...params, ...replyTo, businessConnectionId });
|
|
1117
1152
|
}
|
|
1118
1153
|
/**
|
|
1119
1154
|
* Context-aware alias for {@link Client.sendVoice}.
|
|
1120
1155
|
*/
|
|
1121
1156
|
async replyVoice(voice, params) {
|
|
1122
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1123
|
-
const replyTo =
|
|
1157
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1158
|
+
const replyTo = this.#getReplyTo(params?.isQuoted, chatId, messageId);
|
|
1124
1159
|
return await this.client.sendVoice(chatId, voice, { ...params, ...replyTo, businessConnectionId });
|
|
1125
1160
|
}
|
|
1126
1161
|
/**
|
|
1127
1162
|
* Context-aware alias for {@link Client.resumeBusinessBotConnection}.
|
|
1128
1163
|
*/
|
|
1129
1164
|
async resumeBusinessBotConnection() {
|
|
1130
|
-
const chatId =
|
|
1165
|
+
const chatId = this.#mustGetChatId();
|
|
1131
1166
|
return await this.client.resumeBusinessBotConnection(chatId);
|
|
1132
1167
|
}
|
|
1133
1168
|
/**
|
|
1134
1169
|
* Context-aware alias for {@link Client.scheduleVideoChat}.
|
|
1135
1170
|
*/
|
|
1136
1171
|
async scheduleVideoChat(startAt, params) {
|
|
1137
|
-
const chatId =
|
|
1172
|
+
const chatId = this.#mustGetChatId();
|
|
1138
1173
|
return await this.client.scheduleVideoChat(chatId, startAt, params);
|
|
1139
1174
|
}
|
|
1140
1175
|
/**
|
|
1141
1176
|
* Context-aware alias for {@link Client.searchMessages}.
|
|
1142
1177
|
*/
|
|
1143
1178
|
async searchMessages(params) {
|
|
1144
|
-
const chatId =
|
|
1179
|
+
const chatId = this.#mustGetChatId();
|
|
1145
1180
|
params ??= {};
|
|
1146
1181
|
params.chatId = chatId;
|
|
1147
1182
|
return await this.client.searchMessages(params);
|
|
@@ -1150,77 +1185,77 @@ export class Context {
|
|
|
1150
1185
|
* Context-aware alias for {@link Client.sendChatAction}.
|
|
1151
1186
|
*/
|
|
1152
1187
|
async sendChatAction(action, params) {
|
|
1153
|
-
const chatId =
|
|
1188
|
+
const chatId = this.#mustGetChatId();
|
|
1154
1189
|
return await this.client.sendChatAction(chatId, action, params);
|
|
1155
1190
|
}
|
|
1156
1191
|
/**
|
|
1157
1192
|
* Context-aware alias for {@link Client.sendScheduledMessage}.
|
|
1158
1193
|
*/
|
|
1159
1194
|
async sendScheduledMessage(messageId) {
|
|
1160
|
-
const chatId =
|
|
1195
|
+
const chatId = this.#mustGetChatId();
|
|
1161
1196
|
return await this.client.sendScheduledMessage(chatId, messageId);
|
|
1162
1197
|
}
|
|
1163
1198
|
/**
|
|
1164
1199
|
* Context-aware alias for {@link Client.setAvailableReactions}.
|
|
1165
1200
|
*/
|
|
1166
1201
|
async setAvailableReactions(availableReactions) {
|
|
1167
|
-
const chatId =
|
|
1202
|
+
const chatId = this.#mustGetChatId();
|
|
1168
1203
|
return await this.client.setAvailableReactions(chatId, availableReactions);
|
|
1169
1204
|
}
|
|
1170
1205
|
/**
|
|
1171
1206
|
* Context-aware alias for {@link Client.setBoostsRequiredToCircumventRestrictions}.
|
|
1172
1207
|
*/
|
|
1173
1208
|
async setBoostsRequiredToCircumventRestrictions(boosts) {
|
|
1174
|
-
const chatId =
|
|
1209
|
+
const chatId = this.#mustGetChatId();
|
|
1175
1210
|
return await this.client.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
|
|
1176
1211
|
}
|
|
1177
1212
|
/**
|
|
1178
1213
|
* Context-aware alias for {@link Client.setChatDescription}.
|
|
1179
1214
|
*/
|
|
1180
1215
|
async setChatDescription(description) {
|
|
1181
|
-
const chatId =
|
|
1216
|
+
const chatId = this.#mustGetChatId();
|
|
1182
1217
|
return await this.client.setChatDescription(chatId, description);
|
|
1183
1218
|
}
|
|
1184
1219
|
/**
|
|
1185
1220
|
* Context-aware alias for {@link Client.setChatMemberRights}.
|
|
1186
1221
|
*/
|
|
1187
1222
|
async setChatMemberRights(memberId, params) {
|
|
1188
|
-
const chatId =
|
|
1223
|
+
const chatId = this.#mustGetChatId();
|
|
1189
1224
|
return await this.client.setChatMemberRights(chatId, memberId, params);
|
|
1190
1225
|
}
|
|
1191
1226
|
/**
|
|
1192
1227
|
* Context-aware alias for {@link Client.setChatPhoto}.
|
|
1193
1228
|
*/
|
|
1194
1229
|
async setChatPhoto(photo, params) {
|
|
1195
|
-
const chatId =
|
|
1230
|
+
const chatId = this.#mustGetChatId();
|
|
1196
1231
|
return await this.client.setChatPhoto(chatId, photo, params);
|
|
1197
1232
|
}
|
|
1198
1233
|
/**
|
|
1199
1234
|
* Context-aware alias for {@link Client.setChatStickerSet}.
|
|
1200
1235
|
*/
|
|
1201
1236
|
async setChatStickerSet(setName) {
|
|
1202
|
-
const chatId =
|
|
1237
|
+
const chatId = this.#mustGetChatId();
|
|
1203
1238
|
return await this.client.setChatStickerSet(chatId, setName);
|
|
1204
1239
|
}
|
|
1205
1240
|
/**
|
|
1206
1241
|
* Context-aware alias for {@link Client.setChatTitle}.
|
|
1207
1242
|
*/
|
|
1208
1243
|
async setChatTitle(title) {
|
|
1209
|
-
const chatId =
|
|
1244
|
+
const chatId = this.#mustGetChatId();
|
|
1210
1245
|
return await this.client.setChatTitle(chatId, title);
|
|
1211
1246
|
}
|
|
1212
1247
|
/**
|
|
1213
1248
|
* Context-aware alias for {@link Client.setDiscussionChat}.
|
|
1214
1249
|
*/
|
|
1215
1250
|
async setDiscussionChat(discussionChatId) {
|
|
1216
|
-
const chatId =
|
|
1251
|
+
const chatId = this.#mustGetChatId();
|
|
1217
1252
|
return await this.client.setDiscussionChat(chatId, discussionChatId);
|
|
1218
1253
|
}
|
|
1219
1254
|
/**
|
|
1220
1255
|
* Context-aware alias for {@link Client.setChatMemberTag}.
|
|
1221
1256
|
*/
|
|
1222
1257
|
async setMemberTag(params) {
|
|
1223
|
-
const { chatId, userId } =
|
|
1258
|
+
const { chatId, userId } = this.#mustGetMsg();
|
|
1224
1259
|
if (!userId) {
|
|
1225
1260
|
unreachable();
|
|
1226
1261
|
}
|
|
@@ -1230,21 +1265,21 @@ export class Context {
|
|
|
1230
1265
|
* Context-aware alias for {@link Client.setMessageTtl}.
|
|
1231
1266
|
*/
|
|
1232
1267
|
async setMessageTtl(messageTtl) {
|
|
1233
|
-
const chatId =
|
|
1268
|
+
const chatId = this.#mustGetChatId();
|
|
1234
1269
|
return await this.client.setMessageTtl(chatId, messageTtl);
|
|
1235
1270
|
}
|
|
1236
1271
|
/**
|
|
1237
1272
|
* Context-aware alias for {@link Client.setReactions}.
|
|
1238
1273
|
*/
|
|
1239
1274
|
async setReactions(messageId, reactions, params) {
|
|
1240
|
-
const chatId =
|
|
1275
|
+
const chatId = this.#mustGetChatId();
|
|
1241
1276
|
return await this.client.setReactions(chatId, messageId, reactions, params);
|
|
1242
1277
|
}
|
|
1243
1278
|
/**
|
|
1244
1279
|
* Context-aware alias for {@link Client.setChatMemberRights}.
|
|
1245
1280
|
*/
|
|
1246
1281
|
async setSenderRights(params) {
|
|
1247
|
-
const { chatId, senderId } =
|
|
1282
|
+
const { chatId, senderId } = this.#mustGetMsg();
|
|
1248
1283
|
if (!senderId) {
|
|
1249
1284
|
unreachable();
|
|
1250
1285
|
}
|
|
@@ -1254,168 +1289,118 @@ export class Context {
|
|
|
1254
1289
|
* Context-aware alias for {@link Client.setSlowMode}.
|
|
1255
1290
|
*/
|
|
1256
1291
|
async setSlowMode(duration) {
|
|
1257
|
-
const chatId =
|
|
1292
|
+
const chatId = this.#mustGetChatId();
|
|
1258
1293
|
return await this.client.setSlowMode(chatId, duration);
|
|
1259
1294
|
}
|
|
1260
1295
|
/**
|
|
1261
1296
|
* Context-aware alias for {@link Client.showGeneralTopic}.
|
|
1262
1297
|
*/
|
|
1263
1298
|
async showGeneralTopic() {
|
|
1264
|
-
const chatId =
|
|
1299
|
+
const chatId = this.#mustGetChatId();
|
|
1265
1300
|
return await this.client.showGeneralTopic(chatId);
|
|
1266
1301
|
}
|
|
1267
1302
|
/**
|
|
1268
1303
|
* Context-aware alias for {@link Client.showMemberList}.
|
|
1269
1304
|
*/
|
|
1270
1305
|
async showMemberList() {
|
|
1271
|
-
const chatId =
|
|
1306
|
+
const chatId = this.#mustGetChatId();
|
|
1272
1307
|
return await this.client.showMemberList(chatId);
|
|
1273
1308
|
}
|
|
1274
1309
|
/**
|
|
1275
1310
|
* Context-aware alias for {@link Client.startVideoChat}.
|
|
1276
1311
|
*/
|
|
1277
1312
|
async startVideoChat(params) {
|
|
1278
|
-
const chatId =
|
|
1313
|
+
const chatId = this.#mustGetChatId();
|
|
1279
1314
|
return await this.client.startVideoChat(chatId, params);
|
|
1280
1315
|
}
|
|
1281
1316
|
/**
|
|
1282
1317
|
* Context-aware alias for {@link Client.stopPoll}.
|
|
1283
1318
|
*/
|
|
1284
1319
|
async stopPoll(messageId, params) {
|
|
1285
|
-
const chatId =
|
|
1320
|
+
const chatId = this.#mustGetChatId();
|
|
1286
1321
|
return await this.client.stopPoll(chatId, messageId, params);
|
|
1287
1322
|
}
|
|
1288
1323
|
/**
|
|
1289
1324
|
* Context-aware alias for {@link Client.transcribeVoice}.
|
|
1290
1325
|
*/
|
|
1291
1326
|
async transcribeVoice(messageId) {
|
|
1292
|
-
const chatId =
|
|
1327
|
+
const chatId = this.#mustGetChatId();
|
|
1293
1328
|
return await this.client.transcribeVoice(chatId, messageId);
|
|
1294
1329
|
}
|
|
1295
1330
|
/**
|
|
1296
1331
|
* Context-aware alias for {@link Client.transferChatOwnership}.
|
|
1297
1332
|
*/
|
|
1298
1333
|
async transferOwnership(userId, password) {
|
|
1299
|
-
const chatId =
|
|
1334
|
+
const chatId = this.#mustGetChatId();
|
|
1300
1335
|
return await this.client.transferChatOwnership(chatId, userId, password);
|
|
1301
1336
|
}
|
|
1302
1337
|
/**
|
|
1303
1338
|
* Context-aware alias for {@link Client.unarchiveChat}.
|
|
1304
1339
|
*/
|
|
1305
1340
|
async unarchive() {
|
|
1306
|
-
const chatId =
|
|
1341
|
+
const chatId = this.#mustGetChatId();
|
|
1307
1342
|
return await this.client.unarchiveChat(chatId);
|
|
1308
1343
|
}
|
|
1309
1344
|
/**
|
|
1310
1345
|
* Context-aware alias for {@link Client.unbanChatMember}.
|
|
1311
1346
|
*/
|
|
1312
1347
|
async unbanChatMember(memberId) {
|
|
1313
|
-
const chatId =
|
|
1348
|
+
const chatId = this.#mustGetChatId();
|
|
1314
1349
|
return await this.client.unbanChatMember(chatId, memberId);
|
|
1315
1350
|
}
|
|
1316
1351
|
/**
|
|
1317
1352
|
* Context-aware alias for {@link Client.unblockUser}.
|
|
1318
1353
|
*/
|
|
1319
1354
|
async unblockUser() {
|
|
1320
|
-
return await this.client.unblockUser(
|
|
1355
|
+
return await this.client.unblockUser(this.#mustGetUserId());
|
|
1321
1356
|
}
|
|
1322
1357
|
/**
|
|
1323
1358
|
* Context-aware alias for {@link Client.uncheckChecklistItem}.
|
|
1324
1359
|
*/
|
|
1325
1360
|
async uncheckChecklistItem(messageId, item) {
|
|
1326
|
-
const chatId =
|
|
1361
|
+
const chatId = this.#mustGetChatId();
|
|
1327
1362
|
return await this.client.uncheckChecklistItem(chatId, messageId, item);
|
|
1328
1363
|
}
|
|
1329
1364
|
/**
|
|
1330
1365
|
* Context-aware alias for {@link Client.uncheckChecklistItems}.
|
|
1331
1366
|
*/
|
|
1332
1367
|
async uncheckChecklistItems(messageId, items) {
|
|
1333
|
-
const chatId =
|
|
1368
|
+
const chatId = this.#mustGetChatId();
|
|
1334
1369
|
return await this.client.uncheckChecklistItems(chatId, messageId, items);
|
|
1335
1370
|
}
|
|
1336
1371
|
/**
|
|
1337
1372
|
* Context-aware alias for {@link Client.unpinMessage}.
|
|
1338
1373
|
*/
|
|
1339
1374
|
async unpin() {
|
|
1340
|
-
const { chatId, messageId, businessConnectionId } =
|
|
1375
|
+
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
1341
1376
|
return await this.client.unpinMessage(chatId, messageId, { businessConnectionId });
|
|
1342
1377
|
}
|
|
1343
1378
|
/**
|
|
1344
1379
|
* Context-aware alias for {@link Client.unpinMessage}.
|
|
1345
1380
|
*/
|
|
1346
1381
|
async unpinMessage(messageId) {
|
|
1347
|
-
const chatId =
|
|
1382
|
+
const chatId = this.#mustGetChatId();
|
|
1348
1383
|
return await this.client.unpinMessage(chatId, messageId);
|
|
1349
1384
|
}
|
|
1350
1385
|
/**
|
|
1351
1386
|
* Context-aware alias for {@link Client.unpinMessages}.
|
|
1352
1387
|
*/
|
|
1353
1388
|
async unpinMessages() {
|
|
1354
|
-
const chatId =
|
|
1389
|
+
const chatId = this.#mustGetChatId();
|
|
1355
1390
|
return await this.client.unpinMessages(chatId);
|
|
1356
1391
|
}
|
|
1357
1392
|
/**
|
|
1358
1393
|
* Context-aware alias for {@link Client.unpinTopic}.
|
|
1359
1394
|
*/
|
|
1360
1395
|
async unpinTopic(topicId) {
|
|
1361
|
-
const chatId =
|
|
1396
|
+
const chatId = this.#mustGetChatId();
|
|
1362
1397
|
return await this.client.unpinTopic(chatId, topicId);
|
|
1363
1398
|
}
|
|
1364
1399
|
/**
|
|
1365
1400
|
* Context-aware alias for {@link Client.updateChecklist}.
|
|
1366
1401
|
*/
|
|
1367
1402
|
async updateChecklist(messageId, params) {
|
|
1368
|
-
const chatId =
|
|
1403
|
+
const chatId = this.#mustGetChatId();
|
|
1369
1404
|
return await this.client.updateChecklist(chatId, messageId, params);
|
|
1370
1405
|
}
|
|
1371
1406
|
}
|
|
1372
|
-
_Context_client = new WeakMap(), _Context_me = new WeakMap(), _Context_update = new WeakMap(), _Context_getReplyTo = new WeakMap(), _Context_instances = new WeakSet(), _Context_mustGetMsg = function _Context_mustGetMsg() {
|
|
1373
|
-
if (this.msg !== undefined) {
|
|
1374
|
-
return { chatId: this.msg.chat.id, messageId: this.msg.id, businessConnectionId: this.msg.businessConnectionId, senderId: this.msg.from?.id, userId: this.msg.from?.id };
|
|
1375
|
-
}
|
|
1376
|
-
const reactions = "messageInteractions" in this.update ? this.update.messageInteractions : undefined;
|
|
1377
|
-
if (reactions !== undefined) {
|
|
1378
|
-
return { chatId: reactions.chatId, messageId: reactions.messageId };
|
|
1379
|
-
}
|
|
1380
|
-
else {
|
|
1381
|
-
unreachable();
|
|
1382
|
-
}
|
|
1383
|
-
}, _Context_mustGetChatId = function _Context_mustGetChatId() {
|
|
1384
|
-
if (this.chat) {
|
|
1385
|
-
return this.chat.id;
|
|
1386
|
-
}
|
|
1387
|
-
else {
|
|
1388
|
-
unreachable();
|
|
1389
|
-
}
|
|
1390
|
-
}, _Context_mustGetUserId = function _Context_mustGetUserId() {
|
|
1391
|
-
if (this.msg?.from) {
|
|
1392
|
-
return this.msg.from.id;
|
|
1393
|
-
}
|
|
1394
|
-
else if ("callbackQuery" in this.update) {
|
|
1395
|
-
return this.update.callbackQuery.from.id;
|
|
1396
|
-
}
|
|
1397
|
-
else if ("chosenInlineResult" in this.update) {
|
|
1398
|
-
return this.update.chosenInlineResult.from.id;
|
|
1399
|
-
}
|
|
1400
|
-
else {
|
|
1401
|
-
unreachable();
|
|
1402
|
-
}
|
|
1403
|
-
}, _Context_mustGetInlineMsgId = function _Context_mustGetInlineMsgId() {
|
|
1404
|
-
if ("chosenInlineResult" in this.update) {
|
|
1405
|
-
if (this.update.chosenInlineResult.inlineMessageId) {
|
|
1406
|
-
return this.update.chosenInlineResult.inlineMessageId;
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
else if ("callbackQuery" in this.update) {
|
|
1410
|
-
if (this.update.callbackQuery.inlineMessageId) {
|
|
1411
|
-
return this.update.callbackQuery.inlineMessageId;
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
unreachable();
|
|
1415
|
-
};
|
|
1416
|
-
Object.defineProperty(Context, "has", {
|
|
1417
|
-
enumerable: true,
|
|
1418
|
-
configurable: true,
|
|
1419
|
-
writable: true,
|
|
1420
|
-
value: staticHas
|
|
1421
|
-
});
|