@mtkruto/node 0.79.0 → 0.79.3
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/1_client_generic.d.ts +2 -0
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +2 -4
- package/esm/client/2_context.d.ts +235 -0
- package/esm/client/2_context.d.ts.map +1 -1
- package/esm/client/2_context.js +235 -0
- package/esm/client/5_client.d.ts +2 -0
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +2 -0
- package/esm/client/5_client_dispatcher.d.ts +2 -0
- package/esm/client/5_client_dispatcher.d.ts.map +1 -1
- package/esm/client/5_client_dispatcher.js +2 -0
- package/esm/tl/1_telegram_api.d.ts +2290 -1
- package/esm/tl/1_telegram_api.d.ts.map +1 -1
- package/esm/tl/1_telegram_api.js +1 -1
- package/esm/types/2_chat_member.d.ts +57 -6
- package/esm/types/2_chat_member.d.ts.map +1 -1
- package/esm/types/8_update.d.ts +23 -23
- package/esm/utilities/0_int.d.ts +2 -2
- package/esm/utilities/0_int.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/client/1_client_generic.d.ts +2 -0
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts.map +1 -1
- package/script/client/2_account_manager.js +2 -4
- package/script/client/2_context.d.ts +235 -0
- package/script/client/2_context.d.ts.map +1 -1
- package/script/client/2_context.js +235 -0
- package/script/client/5_client.d.ts +2 -0
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +2 -0
- package/script/client/5_client_dispatcher.d.ts +2 -0
- package/script/client/5_client_dispatcher.d.ts.map +1 -1
- package/script/client/5_client_dispatcher.js +2 -0
- package/script/tl/1_telegram_api.d.ts +2290 -1
- package/script/tl/1_telegram_api.d.ts.map +1 -1
- package/script/tl/1_telegram_api.js +1 -1
- package/script/types/2_chat_member.d.ts +57 -6
- package/script/types/2_chat_member.d.ts.map +1 -1
- package/script/types/8_update.d.ts +23 -23
- package/script/utilities/0_int.d.ts +2 -2
- package/script/utilities/0_int.d.ts.map +1 -1
package/esm/client/2_context.js
CHANGED
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { unreachable } from "../0_deps.js";
|
|
21
21
|
import { toJSON } from "../2_tl.js";
|
|
22
|
+
/**
|
|
23
|
+
* The context object that is passed to the client's update handlers.
|
|
24
|
+
*
|
|
25
|
+
* It wraps the {@link Update} type with shortcuts and method aliases.
|
|
26
|
+
*/
|
|
22
27
|
export class Context {
|
|
23
28
|
#client;
|
|
24
29
|
#me;
|
|
@@ -102,6 +107,11 @@ export class Context {
|
|
|
102
107
|
const from = "callbackQuery" in this.update ? this.update.callbackQuery.from : "inlineQuery" in this.update ? this.update.inlineQuery.from : "chatMember" in this.update ? this.update.chatMember.from : "myChatMember" in this.update ? this.update.myChatMember.from : "messageReactions" in this.update ? this.update.messageReactions.user : "preCheckoutQuery" in this.update ? this.update.preCheckoutQuery.from : "joinRequest" in this.update ? this.update.joinRequest.from : "businessConnection" in this.update ? this.update.businessConnection.user : "pollAnswer" in this.update ? this.update.pollAnswer.from : this.msg?.from;
|
|
103
108
|
return from;
|
|
104
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Returns a representation of the update held in the context that can be converted to JSON.
|
|
112
|
+
*
|
|
113
|
+
* @returns A representation of the update in a way that can be converted to JSON.
|
|
114
|
+
*/
|
|
105
115
|
toJSON() {
|
|
106
116
|
if ("update" in this.update) {
|
|
107
117
|
return { update: toJSON(this.update.update) };
|
|
@@ -110,102 +120,165 @@ export class Context {
|
|
|
110
120
|
return this.update;
|
|
111
121
|
}
|
|
112
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Context-aware alias for {@link Client.sendMessage}.
|
|
125
|
+
*/
|
|
113
126
|
async reply(text, params) {
|
|
114
127
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
115
128
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
116
129
|
return await this.client.sendMessage(chatId, text, { ...params, replyTo, businessConnectionId });
|
|
117
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Context-aware alias for {@link Client.sendPoll}.
|
|
133
|
+
*/
|
|
118
134
|
async replyPoll(question, options, params) {
|
|
119
135
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
120
136
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
121
137
|
return await this.client.sendPoll(chatId, question, options, { ...params, replyTo, businessConnectionId });
|
|
122
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Context-aware alias for {@link Client.sendPhoto}.
|
|
141
|
+
*/
|
|
123
142
|
async replyPhoto(photo, params) {
|
|
124
143
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
125
144
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
126
145
|
return await this.client.sendPhoto(chatId, photo, { ...params, replyTo, businessConnectionId });
|
|
127
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Context-aware alias for {@link Client.sendMediaGroup}.
|
|
149
|
+
*/
|
|
128
150
|
async replyMediaGroup(media, params) {
|
|
129
151
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
130
152
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
131
153
|
return await this.client.sendMediaGroup(chatId, media, { ...params, replyTo, businessConnectionId });
|
|
132
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Context-aware alias for {@link Client.sendInvoice}.
|
|
157
|
+
*/
|
|
133
158
|
async replyInvoice(title, description, payload, currency, prices, params) {
|
|
134
159
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
135
160
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
136
161
|
return await this.client.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, replyTo, businessConnectionId });
|
|
137
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Context-aware alias for {@link Client.sendDocument}.
|
|
165
|
+
*/
|
|
138
166
|
async replyDocument(document, params) {
|
|
139
167
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
140
168
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
141
169
|
return await this.client.sendDocument(chatId, document, { ...params, replyTo, businessConnectionId });
|
|
142
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Context-aware alias for {@link Client.sendSticker}.
|
|
173
|
+
*/
|
|
143
174
|
async replySticker(sticker, params) {
|
|
144
175
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
145
176
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
146
177
|
return await this.client.sendSticker(chatId, sticker, { ...params, replyTo, businessConnectionId });
|
|
147
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Context-aware alias for {@link Client.sendLocation}.
|
|
181
|
+
*/
|
|
148
182
|
async replyLocation(latitude, longitude, params) {
|
|
149
183
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
150
184
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
151
185
|
return await this.client.sendLocation(chatId, latitude, longitude, { ...params, replyTo, businessConnectionId });
|
|
152
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Context-aware alias for {@link Client.sendDice}.
|
|
189
|
+
*/
|
|
153
190
|
async replyDice(params) {
|
|
154
191
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
155
192
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
156
193
|
return await this.client.sendDice(chatId, { ...params, replyTo, businessConnectionId });
|
|
157
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Context-aware alias for {@link Client.sendVenue}.
|
|
197
|
+
*/
|
|
158
198
|
async replyVenue(latitude, longitude, title, address, params) {
|
|
159
199
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
160
200
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
161
201
|
return await this.client.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyTo, businessConnectionId });
|
|
162
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Context-aware alias for {@link Client.sendContact}.
|
|
205
|
+
*/
|
|
163
206
|
async replyContact(firstName, number, params) {
|
|
164
207
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
165
208
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
166
209
|
return await this.client.sendContact(chatId, firstName, number, { ...params, replyTo, businessConnectionId });
|
|
167
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Context-aware alias for {@link Client.sendVideo}.
|
|
213
|
+
*/
|
|
168
214
|
async replyVideo(video, params) {
|
|
169
215
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
170
216
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
171
217
|
return await this.client.sendVideo(chatId, video, { ...params, replyTo, businessConnectionId });
|
|
172
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Context-aware alias for {@link Client.sendAnimation}.
|
|
221
|
+
*/
|
|
173
222
|
async replyAnimation(animation, params) {
|
|
174
223
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
175
224
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
176
225
|
return await this.client.sendAnimation(chatId, animation, { ...params, replyTo, businessConnectionId });
|
|
177
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Context-aware alias for {@link Client.sendVoice}.
|
|
229
|
+
*/
|
|
178
230
|
async replyVoice(voice, params) {
|
|
179
231
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
180
232
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
181
233
|
return await this.client.sendVoice(chatId, voice, { ...params, replyTo, businessConnectionId });
|
|
182
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Context-aware alias for {@link Client.sendAudio}.
|
|
237
|
+
*/
|
|
183
238
|
async replyAudio(audio, params) {
|
|
184
239
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
185
240
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
186
241
|
return await this.client.sendAudio(chatId, audio, { ...params, replyTo, businessConnectionId });
|
|
187
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Context-aware alias for {@link Client.sendVideoNote}.
|
|
245
|
+
*/
|
|
188
246
|
async replyVideoNote(videoNote, params) {
|
|
189
247
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
190
248
|
const replyTo = this.#getReplyTo(params?.quote, chatId, messageId);
|
|
191
249
|
return await this.client.sendVideoNote(chatId, videoNote, { ...params, replyTo, businessConnectionId });
|
|
192
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Context-aware alias for {@link Client.deleteMessage}.
|
|
253
|
+
*/
|
|
193
254
|
async delete() {
|
|
194
255
|
const { chatId, messageId } = this.#mustGetMsg();
|
|
195
256
|
return await this.client.deleteMessage(chatId, messageId);
|
|
196
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Context-aware alias for {@link Client.forwardMessage}.
|
|
260
|
+
*/
|
|
197
261
|
async forward(to, params) {
|
|
198
262
|
const { chatId, messageId } = this.#mustGetMsg();
|
|
199
263
|
return await this.client.forwardMessage(chatId, to, messageId, params);
|
|
200
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Context-aware alias for {@link Client.pinMessage}.
|
|
267
|
+
*/
|
|
201
268
|
async pin(params) {
|
|
202
269
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
203
270
|
return await this.client.pinMessage(chatId, messageId, { ...params, businessConnectionId });
|
|
204
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Context-aware alias for {@link Client.unpinMessage}.
|
|
274
|
+
*/
|
|
205
275
|
async unpin() {
|
|
206
276
|
const { chatId, messageId, businessConnectionId } = this.#mustGetMsg();
|
|
207
277
|
return await this.client.unpinMessage(chatId, messageId, { businessConnectionId });
|
|
208
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Context-aware alias for {@link Client.banChatMember}.
|
|
281
|
+
*/
|
|
209
282
|
async banSender(params) {
|
|
210
283
|
const { chatId, senderId } = this.#mustGetMsg();
|
|
211
284
|
if (!senderId) {
|
|
@@ -213,6 +286,9 @@ export class Context {
|
|
|
213
286
|
}
|
|
214
287
|
return await this.client.banChatMember(chatId, senderId, params);
|
|
215
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Context-aware alias for {@link Client.kickChatMember}.
|
|
291
|
+
*/
|
|
216
292
|
async kickSender() {
|
|
217
293
|
const { chatId, senderId } = this.#mustGetMsg();
|
|
218
294
|
if (!senderId) {
|
|
@@ -220,6 +296,9 @@ export class Context {
|
|
|
220
296
|
}
|
|
221
297
|
return await this.client.kickChatMember(chatId, senderId);
|
|
222
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Context-aware alias for {@link Client.setChatMemberRights}.
|
|
301
|
+
*/
|
|
223
302
|
async setSenderRights(params) {
|
|
224
303
|
const { chatId, senderId } = this.#mustGetMsg();
|
|
225
304
|
if (!senderId) {
|
|
@@ -227,202 +306,349 @@ export class Context {
|
|
|
227
306
|
}
|
|
228
307
|
return await this.client.setChatMemberRights(chatId, senderId, params);
|
|
229
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Context-aware alias for {@link Client.getChatAdministrators}.
|
|
311
|
+
*/
|
|
230
312
|
async getChatAdministrators() {
|
|
231
313
|
const chatId = this.#mustGetChatId();
|
|
232
314
|
return await this.client.getChatAdministrators(chatId);
|
|
233
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Context-aware alias for {@link Client.setReactions}.
|
|
318
|
+
*/
|
|
234
319
|
async react(reactions, params) {
|
|
235
320
|
const { chatId, messageId } = this.#mustGetMsg();
|
|
236
321
|
return await this.client.setReactions(chatId, messageId, reactions, params);
|
|
237
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Context-aware alias for {@link Client.sendChatAction}.
|
|
325
|
+
*/
|
|
238
326
|
async sendChatAction(action, params) {
|
|
239
327
|
const chatId = this.#mustGetChatId();
|
|
240
328
|
return await this.client.sendChatAction(chatId, action, params);
|
|
241
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* Context-aware alias for {@link Client.editInlineMessageText}.
|
|
332
|
+
*/
|
|
242
333
|
async editInlineMessageText(text, params) {
|
|
243
334
|
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
244
335
|
return await this.client.editInlineMessageText(inlineMessageId, text, params);
|
|
245
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* Context-aware alias for {@link Client.editInlineMessageCaption}.
|
|
339
|
+
*/
|
|
246
340
|
async editInlineMessageCaption(params) {
|
|
247
341
|
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
248
342
|
return await this.client.editInlineMessageCaption(inlineMessageId, params);
|
|
249
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Context-aware alias for {@link Client.editInlineMessageMedia}.
|
|
346
|
+
*/
|
|
250
347
|
async editInlineMessageMedia(media, params) {
|
|
251
348
|
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
252
349
|
return await this.client.editInlineMessageMedia(inlineMessageId, media, params);
|
|
253
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* Context-aware alias for {@link Client.editInlineMessageLiveLocation}.
|
|
353
|
+
*/
|
|
254
354
|
async editInlineMessageLiveLocation(latitude, longitude, params) {
|
|
255
355
|
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
256
356
|
return await this.client.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
|
|
257
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Context-aware alias for {@link Client.editInlineMessageReplyMarkup}.
|
|
360
|
+
*/
|
|
258
361
|
async editInlineMessageReplyMarkup(params) {
|
|
259
362
|
const inlineMessageId = this.#mustGetInlineMsgId();
|
|
260
363
|
return await this.client.editInlineMessageReplyMarkup(inlineMessageId, params);
|
|
261
364
|
}
|
|
365
|
+
/**
|
|
366
|
+
* Context-aware alias for {@link Client.editMessageText}.
|
|
367
|
+
*/
|
|
262
368
|
async editMessageText(messageId, text, params) {
|
|
263
369
|
const chatId = this.#mustGetChatId();
|
|
264
370
|
return await this.client.editMessageText(chatId, messageId, text, params);
|
|
265
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Context-aware alias for {@link Client.editMessageCaption}.
|
|
374
|
+
*/
|
|
266
375
|
async editMessageCaption(messageId, params) {
|
|
267
376
|
const chatId = this.#mustGetChatId();
|
|
268
377
|
return await this.client.editMessageCaption(chatId, messageId, params);
|
|
269
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Context-aware alias for {@link Client.editMessageMedia}.
|
|
381
|
+
*/
|
|
270
382
|
async editMessageMedia(messageId, media, params) {
|
|
271
383
|
const chatId = this.#mustGetChatId();
|
|
272
384
|
return await this.client.editMessageMedia(chatId, messageId, media, params);
|
|
273
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Context-aware alias for {@link Client.editMessageLiveLocation}.
|
|
388
|
+
*/
|
|
274
389
|
async editMessageLiveLocation(messageId, latitude, longitude, params) {
|
|
275
390
|
const chatId = this.#mustGetChatId();
|
|
276
391
|
return await this.client.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
|
|
277
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Context-aware alias for {@link Client.editMessageReplyMarkup}.
|
|
395
|
+
*/
|
|
278
396
|
async editMessageReplyMarkup(messageId, params) {
|
|
279
397
|
const chatId = this.#mustGetChatId();
|
|
280
398
|
return await this.client.editMessageReplyMarkup(chatId, messageId, params);
|
|
281
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Context-aware alias for {@link Client.answerCallbackQuery}.
|
|
402
|
+
*/
|
|
282
403
|
async answerCallbackQuery(params) {
|
|
283
404
|
if (!("callbackQuery" in this.update)) {
|
|
284
405
|
unreachable();
|
|
285
406
|
}
|
|
286
407
|
return await this.client.answerCallbackQuery(this.update.callbackQuery.id, params);
|
|
287
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Context-aware alias for {@link Client.answerInlineQuery}.
|
|
411
|
+
*/
|
|
288
412
|
async answerInlineQuery(results, params) {
|
|
289
413
|
if (!("inlineQuery" in this.update)) {
|
|
290
414
|
unreachable();
|
|
291
415
|
}
|
|
292
416
|
return await this.client.answerInlineQuery(this.update.inlineQuery.id, results, params);
|
|
293
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Context-aware alias for {@link Client.getMessage}.
|
|
420
|
+
*/
|
|
294
421
|
async getMessage(messageId) {
|
|
295
422
|
const chatId = this.#mustGetChatId();
|
|
296
423
|
return await this.client.getMessage(chatId, messageId);
|
|
297
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Context-aware alias for {@link Client.getMessages}.
|
|
427
|
+
*/
|
|
298
428
|
async getMessages(messageIds) {
|
|
299
429
|
const chatId = this.#mustGetChatId();
|
|
300
430
|
return await this.client.getMessages(chatId, messageIds);
|
|
301
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Context-aware alias for {@link Client.forwardMessage}.
|
|
434
|
+
*/
|
|
302
435
|
async forwardMessage(to, messageId, params) {
|
|
303
436
|
const chatId = this.#mustGetChatId();
|
|
304
437
|
return await this.client.forwardMessage(chatId, to, messageId, params);
|
|
305
438
|
}
|
|
439
|
+
/**
|
|
440
|
+
* Context-aware alias for {@link Client.forwardMessages}.
|
|
441
|
+
*/
|
|
306
442
|
async forwardMessages(to, messageIds, params) {
|
|
307
443
|
const chatId = this.#mustGetChatId();
|
|
308
444
|
return await this.client.forwardMessages(chatId, to, messageIds, params);
|
|
309
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* Context-aware alias for {@link Client.deleteMessage}.
|
|
448
|
+
*/
|
|
310
449
|
async deleteMessage(messageId, params) {
|
|
311
450
|
const chatId = this.#mustGetChatId();
|
|
312
451
|
return await this.client.deleteMessage(chatId, messageId, params);
|
|
313
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Context-aware alias for {@link Client.deleteMessages}.
|
|
455
|
+
*/
|
|
314
456
|
async deleteMessages(messageIds, params) {
|
|
315
457
|
const chatId = this.#mustGetChatId();
|
|
316
458
|
return await this.client.deleteMessages(chatId, messageIds, params);
|
|
317
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* Context-aware alias for {@link Client.pinMessage}.
|
|
462
|
+
*/
|
|
318
463
|
async pinMessage(messageId, params) {
|
|
319
464
|
const chatId = this.#mustGetChatId();
|
|
320
465
|
return await this.client.pinMessage(chatId, messageId, params);
|
|
321
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* Context-aware alias for {@link Client.unpinMessage}.
|
|
469
|
+
*/
|
|
322
470
|
async unpinMessage(messageId) {
|
|
323
471
|
const chatId = this.#mustGetChatId();
|
|
324
472
|
return await this.client.unpinMessage(chatId, messageId);
|
|
325
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Context-aware alias for {@link Client.unpinMessages}.
|
|
476
|
+
*/
|
|
326
477
|
async unpinMessages() {
|
|
327
478
|
const chatId = this.#mustGetChatId();
|
|
328
479
|
return await this.client.unpinMessages(chatId);
|
|
329
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* Context-aware alias for {@link Client.setAvailableReactions}.
|
|
483
|
+
*/
|
|
330
484
|
async setAvailableReactions(availableReactions) {
|
|
331
485
|
const chatId = this.#mustGetChatId();
|
|
332
486
|
return await this.client.setAvailableReactions(chatId, availableReactions);
|
|
333
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* Context-aware alias for {@link Client.addReaction}.
|
|
490
|
+
*/
|
|
334
491
|
async addReaction(messageId, reaction, params) {
|
|
335
492
|
const chatId = this.#mustGetChatId();
|
|
336
493
|
return await this.client.addReaction(chatId, messageId, reaction, params);
|
|
337
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Context-aware alias for {@link Client.removeReaction}.
|
|
497
|
+
*/
|
|
338
498
|
async removeReaction(messageId, reaction) {
|
|
339
499
|
const chatId = this.#mustGetChatId();
|
|
340
500
|
return await this.client.removeReaction(chatId, messageId, reaction);
|
|
341
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Context-aware alias for {@link Client.setReactions}.
|
|
504
|
+
*/
|
|
342
505
|
async setReactions(messageId, reactions, params) {
|
|
343
506
|
const chatId = this.#mustGetChatId();
|
|
344
507
|
return await this.client.setReactions(chatId, messageId, reactions, params);
|
|
345
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
* Context-aware alias for {@link Client.readMessages}.
|
|
511
|
+
*/
|
|
346
512
|
async read() {
|
|
347
513
|
const { chatId, messageId } = this.#mustGetMsg();
|
|
348
514
|
return await this.client.readMessages(chatId, messageId);
|
|
349
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* Context-aware alias for {@link Client.setChatPhoto}.
|
|
518
|
+
*/
|
|
350
519
|
async setChatPhoto(photo, params) {
|
|
351
520
|
const chatId = this.#mustGetChatId();
|
|
352
521
|
return await this.client.setChatPhoto(chatId, photo, params);
|
|
353
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* Context-aware alias for {@link Client.deleteChatPhoto}.
|
|
525
|
+
*/
|
|
354
526
|
async deletChatPhoto() {
|
|
355
527
|
const chatId = this.#mustGetChatId();
|
|
356
528
|
return await this.client.deleteChatPhoto(chatId);
|
|
357
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* Context-aware alias for {@link Client.banChatMember}.
|
|
532
|
+
*/
|
|
358
533
|
async banChatMember(memberId, params) {
|
|
359
534
|
const chatId = this.#mustGetChatId();
|
|
360
535
|
return await this.client.banChatMember(chatId, memberId, params);
|
|
361
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Context-aware alias for {@link Client.unbanChatMember}.
|
|
539
|
+
*/
|
|
362
540
|
async unbanChatMember(memberId) {
|
|
363
541
|
const chatId = this.#mustGetChatId();
|
|
364
542
|
return await this.client.unbanChatMember(chatId, memberId);
|
|
365
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Context-aware alias for {@link Client.kickChatMember}.
|
|
546
|
+
*/
|
|
366
547
|
async kickChatMember(memberId) {
|
|
367
548
|
const chatId = this.#mustGetChatId();
|
|
368
549
|
return await this.client.kickChatMember(chatId, memberId);
|
|
369
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* Context-aware alias for {@link Client.setChatMemberRights}.
|
|
553
|
+
*/
|
|
370
554
|
async setChatMemberRights(memberId, params) {
|
|
371
555
|
const chatId = this.#mustGetChatId();
|
|
372
556
|
return await this.client.setChatMemberRights(chatId, memberId, params);
|
|
373
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Context-aware alias for {@link Client.promoteChatMember}.
|
|
560
|
+
*/
|
|
374
561
|
async promoteChatMember(userId, params) {
|
|
375
562
|
const chatId = this.#mustGetChatId();
|
|
376
563
|
return await this.client.promoteChatMember(chatId, userId, params);
|
|
377
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Context-aware alias for {@link Client.deleteChatMemberMessages}.
|
|
567
|
+
*/
|
|
378
568
|
async deleteChatMemberMessages(userId) {
|
|
379
569
|
const chatId = this.#mustGetChatId();
|
|
380
570
|
return await this.client.deleteChatMemberMessages(chatId, userId);
|
|
381
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* Context-aware alias for {@link Client.searchMessages}.
|
|
574
|
+
*/
|
|
382
575
|
async searchMessages(params) {
|
|
383
576
|
const chatId = this.#mustGetChatId();
|
|
384
577
|
params ??= {};
|
|
385
578
|
params.chatId = chatId;
|
|
386
579
|
return await this.client.searchMessages(params);
|
|
387
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* Context-aware alias for {@link Client.setBoostsRequiredToCircumventRestrictions}.
|
|
583
|
+
*/
|
|
388
584
|
async setBoostsRequiredToCircumventRestrictions(boosts) {
|
|
389
585
|
const chatId = this.#mustGetChatId();
|
|
390
586
|
return await this.client.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
|
|
391
587
|
}
|
|
588
|
+
/**
|
|
589
|
+
* Context-aware alias for {@link Client.createInviteLink}.
|
|
590
|
+
*/
|
|
392
591
|
async createInviteLink(params) {
|
|
393
592
|
const chatId = this.#mustGetChatId();
|
|
394
593
|
return await this.client.createInviteLink(chatId, params);
|
|
395
594
|
}
|
|
595
|
+
/**
|
|
596
|
+
* Context-aware alias for {@link Client.getCreatedInviteLinks}.
|
|
597
|
+
*/
|
|
396
598
|
async getCreatedInviteLinks(params) {
|
|
397
599
|
const chatId = this.#mustGetChatId();
|
|
398
600
|
return await this.client.getCreatedInviteLinks(chatId, params);
|
|
399
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* Context-aware alias for {@link Client.leaveChat}.
|
|
604
|
+
*/
|
|
400
605
|
async leaveChat() {
|
|
401
606
|
const chatId = this.#mustGetChatId();
|
|
402
607
|
return await this.client.leaveChat(chatId);
|
|
403
608
|
}
|
|
609
|
+
/**
|
|
610
|
+
* Context-aware alias for {@link Client.blockUser}.
|
|
611
|
+
*/
|
|
404
612
|
async blockUser() {
|
|
405
613
|
return await this.client.blockUser(this.#mustGetUserId());
|
|
406
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* Context-aware alias for {@link Client.unblockUser}.
|
|
617
|
+
*/
|
|
407
618
|
async unblockUser() {
|
|
408
619
|
return await this.client.unblockUser(this.#mustGetUserId());
|
|
409
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Context-aware alias for {@link Client.getChatMember}.
|
|
623
|
+
*/
|
|
410
624
|
async getChatMember(userId) {
|
|
411
625
|
const chatId = this.#mustGetChatId();
|
|
412
626
|
return await this.client.getChatMember(chatId, userId);
|
|
413
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* Context-aware alias for {@link Client.getChatMembers}.
|
|
630
|
+
*/
|
|
414
631
|
async getChatMembers(params) {
|
|
415
632
|
const chatId = this.#mustGetChatId();
|
|
416
633
|
return await this.client.getChatMembers(chatId, params);
|
|
417
634
|
}
|
|
635
|
+
/**
|
|
636
|
+
* Context-aware alias for {@link Client.setChatStickerSet}.
|
|
637
|
+
*/
|
|
418
638
|
async setChatStickerSet(setName) {
|
|
419
639
|
const chatId = this.#mustGetChatId();
|
|
420
640
|
return await this.client.setChatStickerSet(chatId, setName);
|
|
421
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* Context-aware alias for {@link Client.deleteChatStickerSet}.
|
|
644
|
+
*/
|
|
422
645
|
async deleteChatStickerSet() {
|
|
423
646
|
const chatId = this.#mustGetChatId();
|
|
424
647
|
return await this.client.deleteChatStickerSet(chatId);
|
|
425
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Context-aware alias for {@link Client.getBusinessConnection}.
|
|
651
|
+
*/
|
|
426
652
|
async getBusinessConnection() {
|
|
427
653
|
const { businessConnectionId } = this.#mustGetMsg();
|
|
428
654
|
if (!businessConnectionId) {
|
|
@@ -430,12 +656,18 @@ export class Context {
|
|
|
430
656
|
}
|
|
431
657
|
return await this.client.getBusinessConnection(businessConnectionId);
|
|
432
658
|
}
|
|
659
|
+
/**
|
|
660
|
+
* Context-aware alias for {@link Client.answerPreCheckoutQuery}.
|
|
661
|
+
*/
|
|
433
662
|
async answerPreCheckoutQuery(ok, params) {
|
|
434
663
|
if (!("preCheckoutQuery" in this.update)) {
|
|
435
664
|
unreachable();
|
|
436
665
|
}
|
|
437
666
|
return await this.client.answerPreCheckoutQuery(this.update.preCheckoutQuery.id, ok, params);
|
|
438
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* Context-aware alias for {@link Client.approveJoinRequest}.
|
|
670
|
+
*/
|
|
439
671
|
async approveJoinRequest() {
|
|
440
672
|
const { chatId, userId } = this.#mustGetMsg();
|
|
441
673
|
if (!userId) {
|
|
@@ -443,6 +675,9 @@ export class Context {
|
|
|
443
675
|
}
|
|
444
676
|
return await this.client.approveJoinRequest(chatId, userId);
|
|
445
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* Context-aware alias for {@link Client.declineJoinRequest}.
|
|
680
|
+
*/
|
|
446
681
|
async declineJoinRequest() {
|
|
447
682
|
const { chatId, userId } = this.#mustGetMsg();
|
|
448
683
|
if (!userId) {
|
package/esm/client/5_client.d.ts
CHANGED
|
@@ -145,6 +145,7 @@ export declare class Client<C extends Context = Context> extends Composer<C> imp
|
|
|
145
145
|
*
|
|
146
146
|
* @param password The password to check
|
|
147
147
|
* @returns The result of the check.
|
|
148
|
+
* @method ac
|
|
148
149
|
*/
|
|
149
150
|
checkPassword(password: string): Promise<PasswordCheckResult>;
|
|
150
151
|
/**
|
|
@@ -152,6 +153,7 @@ export declare class Client<C extends Context = Context> extends Composer<C> imp
|
|
|
152
153
|
*
|
|
153
154
|
* @param password The password to check
|
|
154
155
|
* @returns The result of the check.
|
|
156
|
+
* @method ac
|
|
155
157
|
*/
|
|
156
158
|
checkBotToken(botToken: string): Promise<BotTokenCheckResult>;
|
|
157
159
|
/**
|