ultra-telegram-framework 1.0.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -0
  3. package/dist/adapters/gas.d.ts +10 -0
  4. package/dist/adapters/gas.js +90 -0
  5. package/dist/adapters/node.d.ts +52 -0
  6. package/dist/adapters/node.js +150 -0
  7. package/dist/adapters/web.d.ts +4 -0
  8. package/dist/adapters/web.js +90 -0
  9. package/dist/core/base-api.d.ts +40 -0
  10. package/dist/core/base-api.js +26 -0
  11. package/dist/core/bot.d.ts +1828 -0
  12. package/dist/core/bot.js +2753 -0
  13. package/dist/core/composer.d.ts +87 -0
  14. package/dist/core/composer.js +164 -0
  15. package/dist/core/context/base-context.d.ts +24 -0
  16. package/dist/core/context/base-context.js +56 -0
  17. package/dist/core/context/reply-context.d.ts +234 -0
  18. package/dist/core/context/reply-context.js +528 -0
  19. package/dist/core/context.d.ts +8 -0
  20. package/dist/core/context.js +34 -0
  21. package/dist/core/keyboard.d.ts +76 -0
  22. package/dist/core/keyboard.js +182 -0
  23. package/dist/core/menu.d.ts +58 -0
  24. package/dist/core/menu.js +87 -0
  25. package/dist/index.d.ts +18 -0
  26. package/dist/index.js +24 -0
  27. package/dist/scenes/scene-manager.d.ts +39 -0
  28. package/dist/scenes/scene-manager.js +65 -0
  29. package/dist/scenes/stage.d.ts +8 -0
  30. package/dist/scenes/stage.js +34 -0
  31. package/dist/scenes/wizard.d.ts +18 -0
  32. package/dist/scenes/wizard.js +32 -0
  33. package/dist/session/gas-cache-storage.d.ts +34 -0
  34. package/dist/session/gas-cache-storage.js +49 -0
  35. package/dist/session/gas-hybrid-storage.d.ts +27 -0
  36. package/dist/session/gas-hybrid-storage.js +49 -0
  37. package/dist/session/gas-storage.d.ts +24 -0
  38. package/dist/session/gas-storage.js +47 -0
  39. package/dist/session/index.d.ts +28 -0
  40. package/dist/session/index.js +43 -0
  41. package/dist/session/memory-storage.d.ts +28 -0
  42. package/dist/session/memory-storage.js +35 -0
  43. package/dist/session/storage.d.ts +18 -0
  44. package/dist/session/storage.js +2 -0
  45. package/dist/types/telegram.d.ts +7560 -0
  46. package/dist/types/telegram.js +4 -0
  47. package/package.json +42 -0
@@ -0,0 +1,2753 @@
1
+ // src/bot.ts
2
+ import { Composer } from './composer';
3
+ import { Context } from './context';
4
+ // 1. Pass generic C to Composer
5
+ export class TelegramBot extends Composer {
6
+ constructor(client) {
7
+ super();
8
+ this.client = client;
9
+ }
10
+ /**
11
+ * Main method for processing incoming Updates from Telegram.
12
+ * It automatically creates a base `Context` object and starts the middleware chain.
13
+ * * ⚠️ **Architectural note regarding custom context (Generic C):**
14
+ * This library uses the approach of extending context through interfaces and middlewares
15
+ * (so-called hydration), rather than through class inheritance.
16
+ * Under the hood, a base instance of `Context` is always created, which is forcibly cast to your type `C`.
17
+ * * To add your own fields (e.g., sessions, DB connections, etc.), describe them in an interface
18
+ * and initialize them in your first middleware:
19
+ * * @example
20
+ * interface MyContext extends Context {
21
+ * db: CustomDatabase;
22
+ * session: { step: number };
23
+ * }
24
+ * const bot = new TelegramBot<MyContext>(client);
25
+ * * // Context hydration
26
+ * bot.use(async (ctx, next) => {
27
+ * ctx.db = new CustomDatabase();
28
+ * ctx.session = { step: 0 };
29
+ * await next();
30
+ * });
31
+ * @param update Incoming update from Telegram
32
+ * @returns `Promise<void>`
33
+ */
34
+ async handleUpdate(update) {
35
+ try {
36
+ const ctx = new Context(update, this.client.raw);
37
+ // Start the middleware chain.
38
+ // Call this.middleware(), which returns a function with built-in try/catch and errorHandler
39
+ await this.middleware()(ctx, async () => { });
40
+ }
41
+ catch (error) {
42
+ console.error("❌ Error in the middleware chain:", error);
43
+ }
44
+ }
45
+ async launch(options = {}) {
46
+ var _a;
47
+ console.log("🚀 Bot is starting in Long Polling mode...");
48
+ let offset = 0;
49
+ const timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : 30;
50
+ if (options.drop_pending_updates) {
51
+ await this.client.raw.deleteWebhook({ drop_pending_updates: true });
52
+ }
53
+ else {
54
+ await this.client.raw.deleteWebhook({});
55
+ }
56
+ while (true) {
57
+ try {
58
+ const updates = await this.client.raw.getUpdates({
59
+ offset,
60
+ timeout,
61
+ allowed_updates: options.allowed_updates
62
+ });
63
+ for (const update of updates) {
64
+ offset = update.update_id + 1;
65
+ await this.handleUpdate(update).catch(err => {
66
+ console.error("❌ Error in the middleware chain:", err);
67
+ });
68
+ }
69
+ }
70
+ catch (error) {
71
+ console.error("⚠️ Network or API error during getUpdates:", error);
72
+ await new Promise(resolve => setTimeout(resolve, 3000));
73
+ }
74
+ }
75
+ }
76
+ /**
77
+ * Use this method to receive incoming updates using long polling.
78
+ * Returns an array of `Update` objects.
79
+ *
80
+ * @param options Additional parameters for receiving updates
81
+ * @returns `Update[]` on success
82
+ */
83
+ async getUpdates(options = {}) {
84
+ return this.client.raw.getUpdates(options);
85
+ }
86
+ /**
87
+ * Use this method to specify a URL and receive incoming updates via an outgoing webhook.
88
+ * Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL containing a serialized JSON update.
89
+ * In case of a failed request (a request with an HTTP response status code other than 2XY), we will retry the request and stop its execution after a sufficient number of attempts.
90
+ * Returns `True` on success.
91
+ *
92
+ * If you want to ensure that the webhook was set by you, you can specify secret data in the parameter `secret_token`.
93
+ * If specified, the request will contain an "X-Telegram-Bot-Api-Secret-Token" header with the secret token as its content.
94
+ *
95
+ * **Important:** Ensure that your URL uses a valid SSL certificate. Requests with invalid certificates will be ignored.
96
+ * For testing in a local environment, you can use ngrok or similar services.
97
+ *
98
+ * @param url Webhook URL
99
+ * @param options Additional webhook parameters
100
+ * @returns `boolean` on success
101
+ */
102
+ async setWebhook(url, options) {
103
+ return this.client.raw.setWebhook({ url, ...options });
104
+ }
105
+ /**
106
+ * Use this method to stop using the webhook and start working in long polling mode.
107
+ * Returns `True` on success.
108
+ *
109
+ * @param options Additional parameters for deleting the webhook
110
+ * @returns `boolean` on success
111
+ */
112
+ async deleteWebhook(options) {
113
+ return this.client.raw.deleteWebhook({ ...options });
114
+ }
115
+ /**
116
+ * Use this method to get current information about the webhook set for your bot. Returns `WebhookInfo`.
117
+ *
118
+ * @returns `WebhookInfo` on success
119
+ */
120
+ async getWebhookInfo() {
121
+ return this.client.raw.getWebhookInfo();
122
+ }
123
+ /**
124
+ * Use this method to get information about the bot.
125
+ * Returns `User`.
126
+ *
127
+ * @returns `User` on success
128
+ */
129
+ async getMe() {
130
+ return this.client.raw.getMe();
131
+ }
132
+ /**
133
+ * Use this method to log out the bot.
134
+ * Returns `boolean`.
135
+ *
136
+ * @returns `boolean` on success
137
+ */
138
+ async logOut() {
139
+ return this.client.raw.logOut();
140
+ }
141
+ /**
142
+ * Use this method to close the bot instance before moving it from one local server to another.
143
+ * You need to delete the webhook before calling this method so that the bot doesn't start again after a server restart.
144
+ * The method will return a 429 error during the first 10 minutes after the bot starts.
145
+ * Returns `True` on success.
146
+ *
147
+ * @returns `True` on success
148
+ */
149
+ async close() {
150
+ return this.client.raw.close();
151
+ }
152
+ /**
153
+ * Use this method to send a text message.
154
+ * Returns `Message`.
155
+ *
156
+ * @param chat_id Unique identifier for the target chat or channel username (in the format @channelusername)
157
+ * @param text Message text to send (1-4096 characters after entity parsing)
158
+ * @param options Additional message parameters
159
+ * @returns `Message` on success
160
+ */
161
+ async sendMessage(chat_id, text, options) {
162
+ return this.client.raw.sendMessage({
163
+ chat_id,
164
+ text,
165
+ ...options
166
+ });
167
+ }
168
+ /**
169
+ * Use this method to forward messages of any type.
170
+ * Service messages and messages with protected content cannot be forwarded.
171
+ * On success, the sent message is returned.
172
+ *
173
+ * @param chat_id Unique identifier for the target chat
174
+ * @param from_chat_id Unique identifier for the chat from which the message is forwarded
175
+ * @param message_id Identifier of the message in the `from_chat_id` chat
176
+ * @param options Additional forwarding parameters
177
+ * @returns `Message` on success
178
+ */
179
+ async forwardMessage(chat_id, from_chat_id, message_id, options) {
180
+ return this.client.raw.forwardMessage({
181
+ chat_id,
182
+ from_chat_id,
183
+ message_id,
184
+ ...options
185
+ });
186
+ }
187
+ /**
188
+ * Use this method to forward multiple messages of any type.
189
+ * If some of the specified messages cannot be found or forwarded, they are skipped.
190
+ * Service messages and messages with protected content cannot be forwarded.
191
+ * Grouping by albums is preserved for forwarded messages.
192
+ * On success, an array of `MessageId` of the sent messages is returned.
193
+ *
194
+ * @param chat_id Unique identifier for the target chat
195
+ * @param from_chat_id Unique identifier for the chat from which messages are forwarded
196
+ * @param message_ids Array of message identifiers in the `chat_id` chat
197
+ * @param options Additional forwarding parameters
198
+ * @returns `MessageId[]` on success
199
+ */
200
+ async forwardMessages(chat_id, from_chat_id, message_ids, options) {
201
+ return this.client.raw.forwardMessages({
202
+ chat_id,
203
+ from_chat_id,
204
+ message_ids,
205
+ ...options
206
+ });
207
+ }
208
+ /**
209
+ * Use this method to copy messages of any type.
210
+ * Service messages and messages with protected content cannot be forwarded.
211
+ * On success, the `MessageId` of the sent message is returned.
212
+ *
213
+ * @param chat_id Unique identifier for the target chat
214
+ * @param from_chat_id Unique identifier for the chat from which messages are forwarded
215
+ * @param message_id Identifier of the message in the `chat_id` chat
216
+ * @param options Additional copying parameters
217
+ * @returns `MessageId` on success
218
+ */
219
+ async copyMessage(chat_id, from_chat_id, message_id, options) {
220
+ return this.client.raw.copyMessage({
221
+ chat_id,
222
+ from_chat_id,
223
+ message_id,
224
+ ...options
225
+ });
226
+ }
227
+ /**
228
+ * Use this method to copy multiple messages of any type.
229
+ * If some of the specified messages cannot be found or copied, they are skipped.
230
+ * Service messages and messages with protected content cannot be copied.
231
+ * Grouping by albums is preserved for copied messages.
232
+ * On success, an array of `MessageId` of the copied messages is returned.
233
+ *
234
+ * @param chat_id Unique identifier for the target chat
235
+ * @param from_chat_id Unique identifier for the chat from which messages are forwarded
236
+ * @param message_ids Message identifiers in the `chat_id` chat
237
+ * @param options Additional copying parameters
238
+ * @returns `MessageId[]` on success
239
+ */
240
+ async copyMessages(chat_id, from_chat_id, message_ids, options) {
241
+ return this.client.raw.copyMessages({
242
+ chat_id,
243
+ from_chat_id,
244
+ message_ids,
245
+ ...options
246
+ });
247
+ }
248
+ /**
249
+ * Use this method to send photos in real time.
250
+ * On success, the sent `Message` is returned.
251
+ *
252
+ * @param chat_id Unique identifier for the target chat
253
+ * @param live_photo Video part of a live photo (URL or InputFile)
254
+ * @param photo Photo (URL or InputFile)
255
+ * @param options Additional sending parameters
256
+ * @returns `Promise<Message>`
257
+ */
258
+ async sendLivePhoto(chat_id, live_photo, photo, options) {
259
+ return this.client.raw.sendLivePhoto({
260
+ chat_id,
261
+ photo,
262
+ live_photo,
263
+ ...options
264
+ });
265
+ }
266
+ /**
267
+ * Use this method to send photos.
268
+ * On success, the sent `Message` is returned.
269
+ *
270
+ * @param chat_id Unique identifier for the target chat
271
+ * @param photo Photo to send (File ID, URL or file object)
272
+ * @param options Additional photo parameters
273
+ * @returns `Message` on success
274
+ */
275
+ async sendPhoto(chat_id, photo, options) {
276
+ return this.client.raw.sendPhoto({
277
+ chat_id,
278
+ photo,
279
+ ...options
280
+ });
281
+ }
282
+ /**
283
+ * Use this method to send audio files, if you want Telegram clients to display them in the music player.
284
+ * Your audio file must be in the .MP3 or .M4A format.
285
+ * On success, the sent message is returned.
286
+ * Bots can currently send audio files up to 50 MB, this limit may be changed in the future.
287
+ * For sending voice messages, use the `sendVoice` method.
288
+ *
289
+ * @param chat_id Unique identifier for the target chat
290
+ * @param audio Audio to send (File ID, URL or file object)
291
+ * @param options Additional audio parameters
292
+ * @returns `Message` on success
293
+ */
294
+ async sendAudio(chat_id, audio, options) {
295
+ return this.client.raw.sendAudio({
296
+ chat_id,
297
+ audio,
298
+ ...options
299
+ });
300
+ }
301
+ /**
302
+ * Use this method to send general files.
303
+ * On success, the sent `Message` is returned.
304
+ * Bots can currently send files of any type up to 50 MB, this limit may be changed in the future.
305
+ *
306
+ * @param chat_id Unique identifier for the target chat
307
+ * @param document File to send (File ID, URL or file object)
308
+ * @param options Additional file parameters
309
+ * @returns `Message` on success
310
+ */
311
+ async sendDocument(chat_id, document, options) {
312
+ return this.client.raw.sendDocument({
313
+ chat_id,
314
+ document,
315
+ ...options
316
+ });
317
+ }
318
+ /**
319
+ * Use this method to send video files.
320
+ * Telegram clients support MPEG4 video (other formats can be sent as a document).
321
+ * On success, the sent `Message` is returned.
322
+ * Bots can currently send video files up to 50 MB, this limit may be changed in the future.
323
+ *
324
+ * @param chat_id Unique identifier for the target chat
325
+ * @param video Video to send (File ID, URL or file object)
326
+ * @param options Additional video parameters
327
+ * @returns `Message` on success
328
+ */
329
+ async sendVideo(chat_id, video, options) {
330
+ return this.client.raw.sendVideo({
331
+ chat_id,
332
+ video,
333
+ ...options
334
+ });
335
+ }
336
+ /**
337
+ * Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
338
+ * On success, the sent `Message` is returned.
339
+ * Bots can currently send animation files up to 50 MB, this limit may be changed in the future.
340
+ *
341
+ * @param chat_id Unique identifier for the target chat
342
+ * @param animation Animation to send (File ID, URL or file object)
343
+ * @param options Additional animation parameters
344
+ * @returns `Message` on success
345
+ */
346
+ async sendAnimation(chat_id, animation, options) {
347
+ return this.client.raw.sendAnimation({
348
+ chat_id,
349
+ animation,
350
+ ...options
351
+ });
352
+ }
353
+ /**
354
+ * Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
355
+ * For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 or .M4A format (other formats may be sent as audio or document).
356
+ * On success, the sent message is returned.
357
+ * Bots can currently send voice messages up to 50 MB, this limit may be changed in the future.
358
+ *
359
+ * @param chat_id Unique identifier for the target chat
360
+ * @param voice Audio to send (File ID, URL or file object)
361
+ * @param options Additional audio parameters
362
+ * @returns `Message` on success
363
+ */
364
+ async sendVoice(chat_id, voice, options) {
365
+ return this.client.raw.sendVoice({
366
+ chat_id,
367
+ voice,
368
+ ...options
369
+ });
370
+ }
371
+ /**
372
+ * Use this method to send video messages (videos up to 60 seconds long).
373
+ * Currently, video message duration is limited to 60 seconds, but this limit may be changed in the future.
374
+ * Bots can currently send video messages up to 50 MB, this limit may be changed in the future.
375
+ * On success, the sent `Message` is returned.
376
+ *
377
+ * @param chat_id Unique identifier for the target chat
378
+ * @param video_note Video message to send (File ID, URL or file object)
379
+ * @param options Additional video message parameters
380
+ * @returns `Message` on success
381
+ */
382
+ async sendVideoNote(chat_id, video_note, options) {
383
+ return this.client.raw.sendVideoNote({
384
+ chat_id,
385
+ video_note,
386
+ ...options
387
+ });
388
+ }
389
+ /**
390
+ * Use this method to send paid media files.
391
+ * On success, the sent `Message` is returned.
392
+ *
393
+ * @param chat_id Unique identifier for the target chat
394
+ * @param star_count Number of stars to send
395
+ * @param media Array of paid media files
396
+ * @param options Additional paid media parameters
397
+ * @returns `Message` on success
398
+ */
399
+ async sendPaidMedia(chat_id, star_count, media, options) {
400
+ return this.client.raw.sendPaidMedia({
401
+ chat_id,
402
+ star_count,
403
+ media,
404
+ ...options
405
+ });
406
+ }
407
+ /**
408
+ * Use this method to send a group of photos, videos, documents, or audio as an album.
409
+ * Documents and audio files can only be grouped in an album with messages of the same type.
410
+ * On success, an array of the sent `Message` objects is returned.
411
+ *
412
+ * @param chat_id Unique identifier for the target chat
413
+ * @param media Array of media files to send
414
+ * @param options Additional media file parameters
415
+ * @returns `Message[]` on success
416
+ */
417
+ async sendMediaGroup(chat_id, media, options) {
418
+ return this.client.raw.sendMediaGroup({
419
+ chat_id,
420
+ media,
421
+ ...options
422
+ });
423
+ }
424
+ /**
425
+ * Use this method to send a point on the map.
426
+ * On success, the sent `Message` is returned.
427
+ *
428
+ * @param chat_id Unique identifier for the target chat
429
+ * @param latitude Latitude
430
+ * @param longitude Longitude
431
+ * @param options Additional geolocation parameters
432
+ * @returns `Message` on success
433
+ */
434
+ async sendLocation(chat_id, latitude, longitude, options) {
435
+ return this.client.raw.sendLocation({
436
+ chat_id,
437
+ latitude,
438
+ longitude,
439
+ ...options
440
+ });
441
+ }
442
+ /**
443
+ * Use this method to send venue information.
444
+ * On success, the sent `Message` is returned.
445
+ *
446
+ * @param chat_id Unique identifier for the target chat
447
+ * @param latitude Latitude
448
+ * @param longitude Longitude
449
+ * @param title Venue name
450
+ * @param address Address
451
+ * @param options Additional venue parameters
452
+ * @returns `Message` on success
453
+ */
454
+ async sendVenue(chat_id, latitude, longitude, title, address, options) {
455
+ return this.client.raw.sendVenue({
456
+ chat_id,
457
+ latitude,
458
+ longitude,
459
+ title,
460
+ address,
461
+ ...options
462
+ });
463
+ }
464
+ /**
465
+ * Use this method to send user contact information.
466
+ * On success, the sent `Message` is returned.
467
+ *
468
+ * @param chat_id Unique identifier for the target chat
469
+ * @param phone_number Phone number
470
+ * @param first_name Contact first name
471
+ * @param options Additional contact parameters
472
+ * @returns `Message` on success
473
+ */
474
+ async sendContact(chat_id, phone_number, first_name, options) {
475
+ return this.client.raw.sendContact({
476
+ chat_id,
477
+ phone_number,
478
+ first_name,
479
+ ...options
480
+ });
481
+ }
482
+ /**
483
+ * Use this method to send a poll.
484
+ * On success, the sent `Message` is returned.
485
+ *
486
+ * @param chat_id Unique identifier for the target chat
487
+ * @param question Poll text
488
+ * @param poll_options Array of answer options
489
+ * @param options Additional poll parameters
490
+ * @returns `Message` on success
491
+ */
492
+ async sendPoll(chat_id, question, poll_options, options) {
493
+ return this.client.raw.sendPoll({
494
+ chat_id,
495
+ question,
496
+ options: poll_options,
497
+ ...options
498
+ });
499
+ }
500
+ /**
501
+ * Use this method to send a checklist on behalf of a connected business account.
502
+ * On success, the sent `Message` is returned.
503
+ *
504
+ * @param business_connection_id Business account identifier
505
+ * @param chat_id Unique identifier for the target chat
506
+ * @param checklist Checklist to send
507
+ * @param options Additional checklist parameters
508
+ * @returns `Message` on success
509
+ */
510
+ async sendChecklist(business_connection_id, chat_id, checklist, options) {
511
+ return this.client.raw.sendChecklist({
512
+ business_connection_id,
513
+ chat_id,
514
+ checklist,
515
+ ...options
516
+ });
517
+ }
518
+ /**
519
+ * Use this method to send an animated emoji that will display a random value.
520
+ * Returns `Message` on success.
521
+ *
522
+ * @param chat_id Unique identifier for the target chat
523
+ * @param options Additional animated emoji parameters (emoji, etc.)
524
+ * @returns `Message` on success
525
+ */
526
+ async sendDice(chat_id, options) {
527
+ return this.client.raw.sendDice({
528
+ chat_id,
529
+ ...options
530
+ });
531
+ }
532
+ /**
533
+ * Use this method to stream a part of a message to the user during its generation.
534
+ * Returns `boolean` on success.
535
+ *
536
+ * @param chat_id Unique identifier for the target chat
537
+ * @param draft_id Unique draft identifier
538
+ * @param text Message text
539
+ * @param options Additional draft parameters
540
+ * @returns `boolean` on success
541
+ */
542
+ async sendMessageDraft(chat_id, draft_id, text, options) {
543
+ return this.client.raw.sendMessageDraft({
544
+ chat_id,
545
+ draft_id,
546
+ text,
547
+ ...options
548
+ });
549
+ }
550
+ /**
551
+ * Use this method when you need to inform the user that something is happening on the bot's side.
552
+ * The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
553
+ * Returns `True` on success.
554
+ *
555
+ * **Example:** ImageBot needs some time to process the request and upload the image.
556
+ * Instead of sending a text message like "Getting image, please wait...", the bot can use `sendChatAction` with `action = 'upload_photo'`.
557
+ * The user will see the bot status "uploading photo".
558
+ *
559
+ * @param chat_id Unique identifier for the target chat
560
+ * @param action Type of action to broadcast
561
+ * @param options Additional action parameters
562
+ * @returns `True` on success
563
+ */
564
+ async sendChatAction(chat_id, action, options) {
565
+ return this.client.raw.sendChatAction({
566
+ chat_id,
567
+ action,
568
+ ...options
569
+ });
570
+ }
571
+ /**
572
+ * Use this method to change chosen reactions on a message.
573
+ * Service messages of some types cannot be reacted to.
574
+ * Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel.
575
+ * Bots cannot use paid reactions.
576
+ * Returns `True` on success.
577
+ *
578
+ * @param chat_id Unique identifier for the target chat
579
+ * @param message_id Unique identifier for the message
580
+ * @param reaction Array of reactions to set
581
+ * @returns `True` on success
582
+ */
583
+ async setMessageReaction(chat_id, message_id, reaction) {
584
+ return this.client.raw.setMessageReaction({
585
+ chat_id,
586
+ message_id,
587
+ reaction
588
+ });
589
+ }
590
+ /**
591
+ * Use this method to get a list of user profile photos.
592
+ * Returns a `UserProfilePhotos` object with user photos, starting from the newest.
593
+ *
594
+ * @param user_id Unique identifier for the target user
595
+ * @param options Additional profile photo parameters
596
+ * @returns `UserProfilePhotos` on success
597
+ */
598
+ async getUserProfilePhotos(user_id, options) {
599
+ return this.client.raw.getUserProfilePhotos({
600
+ user_id,
601
+ ...options
602
+ });
603
+ }
604
+ /**
605
+ * Use this method to get a list of user profile audio.
606
+ * Returns a `UserProfileAudios` object.
607
+ *
608
+ * @param user_id Unique identifier for the target user
609
+ * @param options Additional profile audio parameters
610
+ * @returns `UserProfileAudios` on success
611
+ */
612
+ async getUserProfileAudios(user_id, options) {
613
+ return this.client.raw.getUserProfileAudios({
614
+ user_id,
615
+ ...options
616
+ });
617
+ }
618
+ /**
619
+ * Use this method to set a user's emoji status.
620
+ * Returns `True` on success.
621
+ *
622
+ * @param user_id Unique identifier for the target user
623
+ * @param options Additional emoji status parameters
624
+ * @returns `True` on success
625
+ */
626
+ async setUserEmojiStatus(user_id, options) {
627
+ return this.client.raw.setUserEmojiStatus({
628
+ user_id,
629
+ ...options
630
+ });
631
+ }
632
+ /**
633
+ * Use this method to get basic information about a file and prepare it for downloading.
634
+ * Currently, bots can download files of up to 20 MB in size.
635
+ * On success, a `TelegramFile` object is returned.
636
+ * The file can be downloaded via the link `https://api.telegram.org/file/bot<token>/<file_path>`, where `file_path` is taken from the response.
637
+ * It is guaranteed that the link will be valid for at least 1 hour.
638
+ * When the link expires, a new one can be requested by calling `getFile` again.
639
+ *
640
+ * @param file_id Unique file identifier
641
+ * @returns `TelegramFile` with file information
642
+ */
643
+ async getFile(file_id) {
644
+ return this.client.raw.getFile({ file_id });
645
+ }
646
+ /**
647
+ * Use this method to ban a user in a group, a supergroup or a channel.
648
+ * In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first.
649
+ * For this to work, the bot must be an administrator in the chat and have the appropriate administrator rights.
650
+ * Returns `True` on success.
651
+ *
652
+ * @param chat_id Unique identifier for the target chat
653
+ * @param user_id Unique identifier for the target user
654
+ * @param options Additional ban parameters
655
+ * @returns `true` on success
656
+ */
657
+ async banChatMember(chat_id, user_id, options) {
658
+ return this.client.raw.banChatMember({
659
+ chat_id,
660
+ user_id,
661
+ ...options
662
+ });
663
+ }
664
+ /**
665
+ * Use this method to unban a previously banned user in a supergroup or channel.
666
+ * The user **will not return** to the group or channel **automatically**, but **will be able** to join via an **invite link**, etc.
667
+ * The bot must be an administrator for this to work.
668
+ * By default, this method guarantees that after the call the **user will not be** a member of the chat, but **will be able** to join it.
669
+ * So, if the user is a member of the chat, they **will also be removed** from the chat.
670
+ * If you don't want this, use the `only_if_banned` parameter.
671
+ * Returns `True` on success.
672
+ *
673
+ * @param chat_id Unique identifier for the target chat
674
+ * @param user_id Unique identifier for the target user
675
+ * @param options Additional unban parameters
676
+ * @returns `True` on success
677
+ */
678
+ async unbanChatMember(chat_id, user_id, options) {
679
+ return this.client.raw.unbanChatMember({
680
+ chat_id,
681
+ user_id,
682
+ ...options
683
+ });
684
+ }
685
+ /**
686
+ * Use this method to restrict a user in a supergroup.
687
+ * For this to work, the bot must be a supergroup administrator and have the appropriate administrator rights.
688
+ * Pass `True` for all permissions to lift restrictions from a user.
689
+ *
690
+ * @param chat_id Unique identifier for the chat or username of the target bot
691
+ * @param user_id Unique user identifier
692
+ * @param permissions New status of user rights
693
+ * @param options Additional parameters
694
+ * @returns `True` on success
695
+ */
696
+ async restrictChatMember(chat_id, user_id, permissions, options) {
697
+ return this.client.raw.restrictChatMember({
698
+ chat_id,
699
+ user_id,
700
+ permissions,
701
+ ...options
702
+ });
703
+ }
704
+ /**
705
+ * Use this method to promote or demote a user in a supergroup or a channel.
706
+ * For this to work, the bot must be a chat administrator and have the appropriate administrator rights.
707
+ * Pass `False` for all boolean parameters to demote a user.
708
+ * Returns `True` on success.
709
+ *
710
+ * @param chat_id Unique identifier for the chat or username of the target bot
711
+ * @param user_id Unique user identifier
712
+ * @param options Additional parameters
713
+ * @returns `True` on success
714
+ */
715
+ async promoteChatMember(chat_id, user_id, options) {
716
+ return this.client.raw.promoteChatMember({
717
+ chat_id,
718
+ user_id,
719
+ ...options
720
+ });
721
+ }
722
+ /**
723
+ * Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
724
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
725
+ * Returns `True` on success.
726
+ *
727
+ * @param chat_id Unique identifier for the target chat
728
+ * @param user_id Unique identifier for the target user
729
+ * @param custom_title Custom title for the chat administrator
730
+ * @returns `True` on success
731
+ */
732
+ async setChatAdministratorCustomTitle(chat_id, user_id, custom_title) {
733
+ return this.client.raw.setChatAdministratorCustomTitle({
734
+ chat_id,
735
+ user_id,
736
+ custom_title
737
+ });
738
+ }
739
+ /**
740
+ * Use this method to set a tag for a regular group or supergroup member.
741
+ * For this to work, the bot must be a chat administrator and have the `can_manage_tags` administrator right.
742
+ * Returns `True` on success.
743
+ *
744
+ * @param chat_id Unique identifier for the target chat
745
+ * @param user_id Unique identifier for the target user
746
+ * @param options Additional parameters
747
+ * @returns `True` on success
748
+ */
749
+ async setChatMemberTag(chat_id, user_id, options) {
750
+ return this.client.raw.setChatMemberTag({
751
+ chat_id,
752
+ user_id,
753
+ ...options
754
+ });
755
+ }
756
+ /**
757
+ * Use this method to ban a channel chat in a supergroup or channel.
758
+ * Until the chat is unbanned, the owner of the banned chat will not be able to send messages on behalf of any of their channels.
759
+ * For this to work, the bot must be a supergroup or channel administrator and have appropriate administrator rights.
760
+ * Returns `True` on success.
761
+ *
762
+ * @param chat_id Unique identifier for the target chat
763
+ * @param sender_chat_id Unique identifier of the sender
764
+ * @returns `True` on success
765
+ */
766
+ async banChatSenderChat(chat_id, sender_chat_id) {
767
+ return this.client.raw.banChatSenderChat({
768
+ chat_id,
769
+ sender_chat_id
770
+ });
771
+ }
772
+ /**
773
+ * Use this method to unban a previously blocked channel chat in a supergroup or channel.
774
+ * For this to work, the bot must be an administrator and have appropriate administrator rights.
775
+ * Returns `True` on success.
776
+ *
777
+ * @param chat_id Unique identifier for the target chat
778
+ * @param sender_chat_id Unique identifier of the sender
779
+ * @returns `True` on success
780
+ */
781
+ async unbanChatSenderChat(chat_id, sender_chat_id) {
782
+ return this.client.raw.unbanChatSenderChat({
783
+ chat_id,
784
+ sender_chat_id
785
+ });
786
+ }
787
+ /**
788
+ * Use this method to set default chat permissions for all participants.
789
+ * For this to work, the bot must be a group or supergroup administrator and have the `can_restrict_members` administrator right.
790
+ * Returns `True` on success.
791
+ *
792
+ * @param chat_id Unique identifier for the target chat
793
+ * @param permissions New status of user rights
794
+ * @returns `True` on success
795
+ */
796
+ async setChatPermissions(chat_id, permissions, options) {
797
+ return this.client.raw.setChatPermissions({
798
+ chat_id,
799
+ permissions,
800
+ ...options
801
+ });
802
+ }
803
+ /**
804
+ * Use this method to create a new primary invite link for a chat; any previously created primary link will be revoked.
805
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
806
+ * On success, returns the new invite link as a string.
807
+ *
808
+ * @param chat_id Unique identifier for the target chat
809
+ * @returns `string` on success
810
+ */
811
+ async exportChatInviteLink(chat_id) {
812
+ return this.client.raw.exportChatInviteLink({
813
+ chat_id
814
+ });
815
+ }
816
+ /**
817
+ * Use this method to create an additional invite link for a chat.
818
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
819
+ * The link can be revoked using the `revokeChatInviteLink` method.
820
+ * On success, returns the new invite link as a `ChatInviteLink` object.
821
+ *
822
+ * @param chat_id Unique identifier for the target chat
823
+ * @returns `ChatInviteLink` on success
824
+ */
825
+ async createChatInviteLink(chat_id, options) {
826
+ return this.client.raw.createChatInviteLink({
827
+ chat_id,
828
+ ...options
829
+ });
830
+ }
831
+ /**
832
+ * Use this method to edit a non-primary invite link created by the bot.
833
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
834
+ * On success, returns the edited invite link as a `ChatInviteLink` object.
835
+ *
836
+ * @param chat_id Unique identifier for the target chat
837
+ * @param invite_link Chat invite link
838
+ * @param options Parameters for changing the invite link
839
+ * @returns `ChatInviteLink` on success
840
+ */
841
+ async editChatInviteLink(chat_id, invite_link, options) {
842
+ return this.client.raw.editChatInviteLink({
843
+ chat_id,
844
+ invite_link,
845
+ ...options
846
+ });
847
+ }
848
+ /**
849
+ * Use this method to create a subscription invite link for a channel chat.
850
+ * The bot must have the `can_invite_users` administrator right.
851
+ * The link can be edited using the `editChatSubscriptionInviteLink` method or revoked using the `revokeChatInviteLink` method.
852
+ * Returns the new invite link as a `ChatInviteLink` object.
853
+ *
854
+ * @param chat_id Unique identifier for the target chat
855
+ * @param options Parameters for creating the invite link
856
+ * @returns `ChatInviteLink` on success
857
+ */
858
+ async createChatSubscriptionInviteLink(chat_id, subscription_period, subscription_price, options) {
859
+ return this.client.raw.createChatSubscriptionInviteLink({
860
+ chat_id,
861
+ subscription_period,
862
+ subscription_price,
863
+ ...options
864
+ });
865
+ }
866
+ /**
867
+ * Use this method to edit a subscription invite link created by the bot.
868
+ * The bot must have the `can_invite_users` administrator right.
869
+ * On success, returns the edited invite link as a `ChatInviteLink` object.
870
+ *
871
+ * @param chat_id Unique identifier for the target chat
872
+ * @param invite_link Chat invite link
873
+ * @param options Parameters for editing the invite link
874
+ * @returns `ChatInviteLink` on success
875
+ */
876
+ async editChatSubscriptionInviteLink(chat_id, invite_link, options) {
877
+ return this.client.raw.editChatSubscriptionInviteLink({
878
+ chat_id,
879
+ invite_link,
880
+ ...options
881
+ });
882
+ }
883
+ /**
884
+ * Use this method to revoke an invite link created by the bot.
885
+ * If the primary link is revoked, a new link is automatically generated.
886
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
887
+ * On success, returns the revoked invite link as a `ChatInviteLink` object.
888
+ *
889
+ * @param chat_id Unique identifier for the target chat
890
+ * @param invite_link Chat invite link
891
+ * @returns `ChatInviteLink` on success
892
+ */
893
+ async revokeChatInviteLink(chat_id, invite_link) {
894
+ return this.client.raw.revokeChatInviteLink({
895
+ chat_id,
896
+ invite_link
897
+ });
898
+ }
899
+ /**
900
+ * Use this method to approve a chat join request.
901
+ * For this to work, the bot must be a chat administrator and have the `can_invite_users` administrator right.
902
+ * Returns `True` on success.
903
+ *
904
+ * @param chat_id Unique identifier for the target chat
905
+ * @param user_id Unique user identifier
906
+ * @returns `boolean` on success
907
+ */
908
+ async approveChatJoinRequest(chat_id, user_id) {
909
+ return this.client.raw.approveChatJoinRequest({
910
+ chat_id,
911
+ user_id
912
+ });
913
+ }
914
+ /**
915
+ * Use this method to decline a chat join request.
916
+ * For this to work, the bot must be a chat administrator and have the `can_invite_users` administrator right.
917
+ * Returns `True` on success.
918
+ *
919
+ * @param chat_id Unique identifier for the target chat
920
+ * @param user_id Unique user identifier
921
+ * @returns `boolean` on success
922
+ */
923
+ async declineChatJoinRequest(chat_id, user_id) {
924
+ return this.client.raw.declineChatJoinRequest({
925
+ chat_id,
926
+ user_id
927
+ });
928
+ }
929
+ /**
930
+ * Use this method to upload a new profile photo for a chat.
931
+ * For this to work, the bot must be a chat administrator.
932
+ *
933
+ * @param chat_id Unique identifier for the target chat
934
+ * @param photo Photo to upload.
935
+ * @returns `true` on success
936
+ */
937
+ async setChatPhoto(chat_id, photo) {
938
+ return this.client.raw.setChatPhoto({
939
+ chat_id,
940
+ photo
941
+ });
942
+ }
943
+ /**
944
+ * Use this method to delete a chat profile photo.
945
+ * For this to work, the bot must be a chat administrator.
946
+ * Returns `true` on success.
947
+ *
948
+ * @param chat_id Unique identifier for the target chat
949
+ * @returns `boolean` on success
950
+ */
951
+ async deleteChatPhoto(chat_id) {
952
+ return this.client.raw.deleteChatPhoto({
953
+ chat_id
954
+ });
955
+ }
956
+ /**
957
+ * Use this method to change the chat title. Titles cannot be changed for private chats.
958
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
959
+ * Returns `True` on success.
960
+ *
961
+ * @param chat_id Unique identifier for the target chat
962
+ * @param title New chat title
963
+ * @returns `True` on success
964
+ */
965
+ async setChatTitle(chat_id, title) {
966
+ return this.client.raw.setChatTitle({
967
+ chat_id,
968
+ title
969
+ });
970
+ }
971
+ /**
972
+ * Use this method to change the description of a group, supergroup, or channel.
973
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
974
+ * Returns `true` on success.
975
+ *
976
+ * @param chat_id Unique identifier for the target chat
977
+ * @param description New chat description
978
+ * @returns `True` on success
979
+ */
980
+ async setChatDescription(chat_id, description) {
981
+ return this.client.raw.setChatDescription({
982
+ chat_id,
983
+ description
984
+ });
985
+ }
986
+ /**
987
+ * Use this method to add a message to the list of pinned messages in a chat.
988
+ * In private chats and channel direct message chats, all non-service messages can be pinned.
989
+ * Conversely, the bot must be an administrator with the `can_pin_messages` or `can_edit_messages` right to pin messages in groups and channels respectively.
990
+ * Returns `True` on success.
991
+ *
992
+ * @param chat_id Unique identifier for the target chat
993
+ * @param message_id Identifier of the message to pin
994
+ * @returns `True` on success
995
+ */
996
+ async pinChatMessage(chat_id, message_id, options) {
997
+ return this.client.raw.pinChatMessage({
998
+ chat_id,
999
+ message_id,
1000
+ ...options
1001
+ });
1002
+ }
1003
+ /**
1004
+ * Use this method to remove a message from the list of pinned messages in a chat.
1005
+ * In private chats and channel direct message chats, all messages can be unpinned.
1006
+ * Conversely, the bot must be an administrator with the `can_pin_messages` or `can_edit_messages` right to unpin messages in groups and channels respectively.
1007
+ * Returns `True` on success.
1008
+ *
1009
+ * @param chat_id Unique identifier for the target chat
1010
+ * @param options Additional parameters (message_id, etc.)
1011
+ * @returns `True` on success
1012
+ */
1013
+ async unpinChatMessage(chat_id, options) {
1014
+ return this.client.raw.unpinChatMessage({
1015
+ chat_id,
1016
+ ...options
1017
+ });
1018
+ }
1019
+ /**
1020
+ * Use this method to clear the list of pinned messages in a chat.
1021
+ * In private chats and channel direct message chats, no additional rights are required to unpin all pinned messages.
1022
+ * Conversely, the bot must be an administrator with the `can_pin_messages` or `can_edit_messages` right to unpin all pinned messages in groups and channels respectively.
1023
+ * Returns `True` on success.
1024
+ *
1025
+ * @param chat_id Unique identifier for the target chat
1026
+ * @returns `True` on success
1027
+ */
1028
+ async unpinAllChatMessages(chat_id) {
1029
+ return this.client.raw.unpinAllChatMessages({
1030
+ chat_id
1031
+ });
1032
+ }
1033
+ /**
1034
+ * Use this method for your bot to leave a group, supergroup, or channel.
1035
+ * Returns `True` on success.
1036
+ *
1037
+ * @param chat_id Unique identifier for the target chat
1038
+ * @returns `True` on success
1039
+ */
1040
+ async leaveChat(chat_id) {
1041
+ return this.client.raw.leaveChat({
1042
+ chat_id
1043
+ });
1044
+ }
1045
+ /**
1046
+ * Use this method to get up-to-date information about the chat.
1047
+ * On success, returns a `ChatFullInfo` object.
1048
+ *
1049
+ * @param chat_id Unique identifier for the target chat
1050
+ * @returns `ChatFullInfo` on success
1051
+ */
1052
+ async getChat(chat_id) {
1053
+ return this.client.raw.getChat({
1054
+ chat_id
1055
+ });
1056
+ }
1057
+ /**
1058
+ * Use this method to get a list of administrators in a chat who are not bots.
1059
+ * On success, returns an array of `ChatMember` objects.
1060
+ *
1061
+ * @param chat_id Unique identifier for the target chat
1062
+ * @param options Additional parameters
1063
+ * @returns `ChatMember[]` on success
1064
+ */
1065
+ async getChatAdministrators(chat_id, options) {
1066
+ return this.client.raw.getChatAdministrators({
1067
+ chat_id,
1068
+ ...options
1069
+ });
1070
+ }
1071
+ /**
1072
+ * Use this method to get the number of members in a chat.
1073
+ * Returns `int` on success.
1074
+ *
1075
+ * @param chat_id Unique identifier for the target chat
1076
+ * @returns `number` on success
1077
+ */
1078
+ async getChatMemberCount(chat_id) {
1079
+ return this.client.raw.getChatMemberCount({
1080
+ chat_id
1081
+ });
1082
+ }
1083
+ /**
1084
+ * Use this method to get information about a chat member.
1085
+ * The method is guaranteed to work for other users only if the bot is a chat administrator.
1086
+ * On success, returns a `ChatMember` object.
1087
+ *
1088
+ * @param chat_id Unique identifier for the target chat
1089
+ * @param user_id User identifier
1090
+ * @returns `ChatMember` on success
1091
+ */
1092
+ async getChatMember(chat_id, user_id) {
1093
+ return this.client.raw.getChatMember({
1094
+ chat_id,
1095
+ user_id
1096
+ });
1097
+ }
1098
+ /**
1099
+ * Use this method to set a new set of group stickers for a supergroup.
1100
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
1101
+ * Use the `can_set_sticker_set` field, which is optionally returned in `getChat` requests, to check if the bot can use this method.
1102
+ * Returns `True` on success.
1103
+ *
1104
+ * @param chat_id Unique identifier for the target chat
1105
+ * @param sticker_set_name Sticker set name
1106
+ * @returns `True` on success
1107
+ */
1108
+ async setChatStickerSet(chat_id, sticker_set_name) {
1109
+ return this.client.raw.setChatStickerSet({
1110
+ chat_id,
1111
+ sticker_set_name
1112
+ });
1113
+ }
1114
+ /**
1115
+ * Use this method to delete a set of group stickers from a supergroup.
1116
+ * For this to work, the bot must be a chat administrator and have appropriate administrator rights.
1117
+ * Use the `can_set_sticker_set` field, which is optionally returned in `getChat` requests, to check if the bot can use this method.
1118
+ * Returns `True` on success.
1119
+ *
1120
+ * @param chat_id Unique identifier for the target chat
1121
+ * @returns `True` on success
1122
+ */
1123
+ async deleteChatStickerSet(chat_id) {
1124
+ return this.client.raw.deleteChatStickerSet({
1125
+ chat_id
1126
+ });
1127
+ }
1128
+ /**
1129
+ * Use this method to delete a reaction from a message in a group or supergroup chat.
1130
+ * The bot must have the `can_delete_messages` administrator right in the chat.
1131
+ * Returns `True` on success.
1132
+ *
1133
+ * @param chat_id Unique identifier for the target chat
1134
+ * @param message_id Message identifier
1135
+ * @param options Additional parameters
1136
+ * @returns `True` on success
1137
+ */
1138
+ async deleteMessageReaction(chat_id, message_id, options) {
1139
+ return this.client.raw.deleteMessageReaction({
1140
+ chat_id,
1141
+ message_id,
1142
+ ...options
1143
+ });
1144
+ }
1145
+ /**
1146
+ * Use this method to delete up to 10000 recent reactions in a group or supergroup chat added by a specific user or chat.
1147
+ * The bot must have the `can_delete_messages` administrator right in the chat.
1148
+ * Returns `True` on success.
1149
+ *
1150
+ * @param chat_id Unique identifier for the target chat
1151
+ * @param options Additional parameters
1152
+ * @returns `True` on success
1153
+ */
1154
+ async deleteAllMessageReactions(chat_id, options) {
1155
+ return this.client.raw.deleteAllMessageReactions({
1156
+ chat_id,
1157
+ ...options
1158
+ });
1159
+ }
1160
+ /**
1161
+ * Use this method to get custom emoji stickers that any user can use as a forum topic icon.
1162
+ * Requires no parameters. Returns an array of `Sticker` objects.
1163
+ *
1164
+ * @returns `Sticker[]` on success
1165
+ */
1166
+ async getForumTopicIconStickers() {
1167
+ return this.client.raw.getForumTopicIconStickers();
1168
+ }
1169
+ /**
1170
+ * Use this method to create a topic in a forum supergroup chat or in a private chat with a user.
1171
+ * In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the `can_manage_topics` administrator right.
1172
+ * Returns information about the created topic as a `ForumTopic` object.
1173
+ *
1174
+ * @param chat_id Unique identifier for the target chat
1175
+ * @param name Forum topic name
1176
+ * @param options Additional parameters (icon_custom_emoji_id, etc.)
1177
+ * @returns `ForumTopic` on success
1178
+ */
1179
+ async createForumTopic(chat_id, name, options) {
1180
+ return this.client.raw.createForumTopic({
1181
+ chat_id,
1182
+ name,
1183
+ ...options
1184
+ });
1185
+ }
1186
+ /**
1187
+ * Use this method to edit the name and icon of a topic in a forum supergroup chat or in a private chat with a user.
1188
+ * In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the `can_manage_topics` administrator right, unless it is the topic author.
1189
+ * Returns `True` on success.
1190
+ *
1191
+ * @param chat_id Unique identifier for the target chat
1192
+ * @param message_thread_id Forum topic identifier
1193
+ * @param options Additional parameters (name, icon_custom_emoji_id)
1194
+ * @returns `true` on success
1195
+ */
1196
+ async editForumTopic(chat_id, message_thread_id, options) {
1197
+ return this.client.raw.editForumTopic({
1198
+ chat_id,
1199
+ message_thread_id,
1200
+ ...options
1201
+ });
1202
+ }
1203
+ /**
1204
+ * Use this method to close an open topic in a forum supergroup chat.
1205
+ * For this to work, the bot must be a chat administrator and have the `can_manage_topics` administrator right, unless it is the topic author.
1206
+ * Returns `True` on success.
1207
+ *
1208
+ * @param chat_id Unique identifier for the target chat
1209
+ * @param message_thread_id Forum topic identifier
1210
+ * @returns `True` on success
1211
+ */
1212
+ async closeForumTopic(chat_id, message_thread_id) {
1213
+ return this.client.raw.closeForumTopic({
1214
+ chat_id,
1215
+ message_thread_id
1216
+ });
1217
+ }
1218
+ /**
1219
+ * Use this method to reopen a closed topic in a forum supergroup chat.
1220
+ * For this to work, the bot must be a chat administrator and have the `can_manage_topics` administrator right, unless it is the topic author.
1221
+ * Returns `True` on success.
1222
+ *
1223
+ * @param chat_id Unique identifier for the target chat
1224
+ * @param message_thread_id Forum topic identifier
1225
+ * @returns `True` on success
1226
+ */
1227
+ async reopenForumTopic(chat_id, message_thread_id) {
1228
+ return this.client.raw.reopenForumTopic({
1229
+ chat_id,
1230
+ message_thread_id
1231
+ });
1232
+ }
1233
+ /**
1234
+ * Use this method to delete a forum topic along with all its messages in a forum supergroup chat or in a private chat with a user.
1235
+ * In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the `can_delete_messages` administrator right.
1236
+ * Returns `True` on success.
1237
+ *
1238
+ * @param chat_id Unique identifier for the target chat
1239
+ * @param message_thread_id Forum topic identifier
1240
+ * @returns `True` on success
1241
+ */
1242
+ async deleteForumTopic(chat_id, message_thread_id) {
1243
+ return this.client.raw.deleteForumTopic({
1244
+ chat_id,
1245
+ message_thread_id
1246
+ });
1247
+ }
1248
+ /**
1249
+ * Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or in a private chat with a user.
1250
+ * In the case of a supergroup chat, the bot must be a chat administrator for this to work and must have the `can_pin_messages` administrator right in the supergroup.
1251
+ * Returns `True` on success.
1252
+ *
1253
+ * @param chat_id Unique identifier for the target chat
1254
+ * @param message_thread_id Forum topic identifier
1255
+ * @returns `True` on success
1256
+ */
1257
+ async unpinAllForumTopicMessages(chat_id, message_thread_id) {
1258
+ return this.client.raw.unpinAllForumTopicMessages({
1259
+ chat_id,
1260
+ message_thread_id
1261
+ });
1262
+ }
1263
+ /**
1264
+ * Use this method to edit the name of the "General" topic in a forum supergroup chat.
1265
+ * For this to work, the bot must be a chat administrator and have the `can_manage_topics` administrator right.
1266
+ * Returns `True` on success.
1267
+ *
1268
+ * @param chat_id Unique identifier for the target chat
1269
+ * @param name New forum topic name
1270
+ * @returns `True` on success
1271
+ */
1272
+ async editGeneralForumTopic(chat_id, name) {
1273
+ return this.client.raw.editGeneralForumTopic({
1274
+ chat_id,
1275
+ name
1276
+ });
1277
+ }
1278
+ /**
1279
+ * Use this method to close an open "General" topic in a forum supergroup chat.
1280
+ * For this to work, the bot must be a chat administrator and have the `can_manage_topics` administrator right.
1281
+ * Returns `True` on success.
1282
+ *
1283
+ * @param chat_id Unique identifier for the target chat
1284
+ * @returns `True` on success
1285
+ */
1286
+ async closeGeneralForumTopic(chat_id) {
1287
+ return this.client.raw.closeGeneralForumTopic({
1288
+ chat_id
1289
+ });
1290
+ }
1291
+ /**
1292
+ * Use this method to reopen a closed "General" topic in a forum supergroup chat.
1293
+ * For this to work, the bot must be a chat administrator and have the `can_manage_topics` administrator right.
1294
+ * The topic will be automatically shown if it was hidden.
1295
+ * Returns `True` on success.
1296
+ *
1297
+ * @param chat_id Unique identifier for the target chat
1298
+ * @returns `True` on success
1299
+ */
1300
+ async reopenGeneralForumTopic(chat_id) {
1301
+ return this.client.raw.reopenGeneralForumTopic({
1302
+ chat_id
1303
+ });
1304
+ }
1305
+ /**
1306
+ * Use this method to hide the "General" topic in a forum supergroup chat.
1307
+ * For this to work, the bot must be a chat administrator and have the `can_manage_topics` administrator right.
1308
+ * The topic will be automatically closed if it was open.
1309
+ * Returns `True` on success.
1310
+ *
1311
+ * @param chat_id Unique identifier for the target chat
1312
+ * @returns `True` on success
1313
+ */
1314
+ async hideGeneralForumTopic(chat_id) {
1315
+ return this.client.raw.hideGeneralForumTopic({
1316
+ chat_id
1317
+ });
1318
+ }
1319
+ /**
1320
+ * Use this method to unhide the "General" topic in a forum supergroup chat.
1321
+ * For this to work, the bot must be a chat administrator and have the `can_manage_topics` administrator right.
1322
+ * Returns `True` on success.
1323
+ *
1324
+ * @param chat_id Unique identifier for the target chat
1325
+ * @returns `True` on success
1326
+ */
1327
+ async unhideGeneralForumTopic(chat_id) {
1328
+ return this.client.raw.unhideGeneralForumTopic({
1329
+ chat_id
1330
+ });
1331
+ }
1332
+ /**
1333
+ * Use this method to clear the list of pinned messages in a General forum topic.
1334
+ * For this to work, the bot must be a chat administrator and have the `can_pin_messages` administrator right in the supergroup.
1335
+ * Returns `True` on success.
1336
+ *
1337
+ * @param chat_id Unique identifier for the target chat
1338
+ * @returns `True` on success
1339
+ */
1340
+ async unpinAllGeneralForumTopicMessages(chat_id) {
1341
+ return this.client.raw.unpinAllGeneralForumTopicMessages({
1342
+ chat_id
1343
+ });
1344
+ }
1345
+ /**
1346
+ * Use this method to send answers to callback queries sent from inline keyboards.
1347
+ * The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
1348
+ * Returns `True` on success.
1349
+ *
1350
+ * Alternatively, the user can be redirected to a specified game URL.
1351
+ * For this option to work, you must first create a game for your bot via `@BotFather` and accept the terms.
1352
+ * Otherwise, you can use links like `t.me/your_bot?start=XXXX` which open your bot with a parameter.
1353
+ *
1354
+ * @param callback_query_id Unique query identifier
1355
+ * @param options Additional response parameters (text, show_alert, url, etc.)
1356
+ * @returns `True` on success
1357
+ */
1358
+ async answerCallbackQuery(callback_query_id, options) {
1359
+ return this.client.raw.answerCallbackQuery({
1360
+ callback_query_id,
1361
+ ...options
1362
+ });
1363
+ }
1364
+ /**
1365
+ * Use this method to reply to a received guest query.
1366
+ * On success, a `SentGuestMessage` object is returned.
1367
+ *
1368
+ * @param guest_query_id Unique query identifier
1369
+ * @param result Serialized JSON object describing the message to be sent.
1370
+ * @returns `SentGuestMessage`
1371
+ */
1372
+ async answerGuestQuery(guest_query_id, result) {
1373
+ return this.client.raw.answerGuestQuery({
1374
+ guest_query_id,
1375
+ result
1376
+ });
1377
+ }
1378
+ /**
1379
+ * Use this method to get information about boosts provided by a chat user.
1380
+ * Returns `UserChatBoosts` on success.
1381
+ *
1382
+ * @param chat_id Unique identifier for the target chat
1383
+ * @param user_id Unique user identifier
1384
+ * @returns `UserChatBoosts`
1385
+ */
1386
+ async getUserChatBoosts(chat_id, user_id) {
1387
+ return this.client.raw.getUserChatBoosts({
1388
+ chat_id,
1389
+ user_id
1390
+ });
1391
+ }
1392
+ /**
1393
+ * Use this method to get information about the bot's connection to a business account.
1394
+ * Returns a `BusinessConnection` object on success.
1395
+ *
1396
+ * @param business_connection_id Unique business connection identifier
1397
+ * @returns `BusinessConnection` with connection information
1398
+ */
1399
+ async getBusinessConnection(business_connection_id) {
1400
+ return this.client.raw.getBusinessConnection({
1401
+ business_connection_id
1402
+ });
1403
+ }
1404
+ /**
1405
+ * Use this method to get a managed bot token.
1406
+ * Returns the token as a string on success.
1407
+ *
1408
+ * @param user_id Unique user identifier (managed bot)
1409
+ * @returns `string` token as a string
1410
+ */
1411
+ async getManagedBotToken(user_id) {
1412
+ return this.client.raw.getManagedBotToken({
1413
+ user_id
1414
+ });
1415
+ }
1416
+ /**
1417
+ * Use this method to revoke the current managed bot token and generate a new one.
1418
+ * Returns the new token as a string on success.
1419
+ *
1420
+ * @param user_id Unique user identifier (managed bot)
1421
+ * @returns New token as a string
1422
+ */
1423
+ async replaceManagedBotToken(user_id) {
1424
+ return this.client.raw.replaceManagedBotToken({
1425
+ user_id
1426
+ });
1427
+ }
1428
+ /**
1429
+ * Use this method to get managed bot access settings.
1430
+ * Returns a `BotAccessSettings` object on success.
1431
+ *
1432
+ * @param user_id Unique user identifier (managed bot)
1433
+ * @returns `BotAccessSettings` with access settings
1434
+ */
1435
+ async getManagedBotAccessSettings(user_id) {
1436
+ return this.client.raw.getManagedBotAccessSettings({
1437
+ user_id
1438
+ });
1439
+ }
1440
+ /**
1441
+ * Use this method to change managed bot access settings.
1442
+ * Returns `True` on success.
1443
+ *
1444
+ * @param user_id Unique user identifier (managed bot)
1445
+ * @param is_access_restricted `True` if only selected users have access to the bot. The bot owner always has access.
1446
+ * @param options Additional parameters (see `SetManagedBotAccessSettingsParams`)
1447
+ * @returns `True` on success
1448
+ */
1449
+ async setManagedBotAccessSettings(user_id, is_access_restricted, options) {
1450
+ return this.client.raw.setManagedBotAccessSettings({
1451
+ user_id,
1452
+ is_access_restricted,
1453
+ ...options
1454
+ });
1455
+ }
1456
+ /**
1457
+ * Use this method to get recent messages from a given user's personal chat.
1458
+ * Returns an array of `Message` objects on success.
1459
+ *
1460
+ * @param user_id Unique user identifier
1461
+ * @param limit Maximum number of messages to return; 1-20
1462
+ * @returns Array of `Message` objects
1463
+ */
1464
+ async getUserPersonalChatMessages(user_id, limit) {
1465
+ return this.client.raw.getUserPersonalChatMessages({
1466
+ user_id,
1467
+ limit
1468
+ });
1469
+ }
1470
+ /**
1471
+ * Use this method to change the list of bot commands.
1472
+ * See this [guide](https://core.telegram.org/bots/features#commands) for more information about bot commands.
1473
+ * Returns `True` on success.
1474
+ *
1475
+ * @param commands List of commands for the bot (max 100)
1476
+ * @param options Additional parameters (scope, language_code)
1477
+ * @returns `True` on success
1478
+ */
1479
+ async setMyCommands(commands, options) {
1480
+ return this.client.raw.setMyCommands({
1481
+ commands,
1482
+ ...options
1483
+ });
1484
+ }
1485
+ /**
1486
+ * Use this method to delete the list of bot commands for a given scope and user language.
1487
+ * After deletion, [higher-level commands](https://core.telegram.org/bots/api#determining-list-of-commands) will be shown to affected users.
1488
+ * Returns `True` on success.
1489
+ *
1490
+ * @param options Additional parameters (scope, language_code)
1491
+ * @returns `True` on success
1492
+ */
1493
+ async deleteMyCommands(options) {
1494
+ return this.client.raw.deleteMyCommands({
1495
+ ...options
1496
+ });
1497
+ }
1498
+ /**
1499
+ * Use this method to get the current list of bot commands for a given scope and user language.
1500
+ * Returns an array of [BotCommand](https://core.telegram.org/bots/api#botcommand) objects.
1501
+ * If commands are not set, an empty list is returned.
1502
+ *
1503
+ * @param options Additional parameters (scope, language_code)
1504
+ * @returns Array of [BotCommand](https://core.telegram.org/bots/api#botcommand) objects
1505
+ */
1506
+ async getMyCommands(options) {
1507
+ return this.client.raw.getMyCommands({
1508
+ ...options
1509
+ });
1510
+ }
1511
+ /**
1512
+ * Use this method to change the bot's name.
1513
+ * Returns `True` on success.
1514
+ *
1515
+ * @param options Additional parameters (name, language_code)
1516
+ * @returns `True` on success
1517
+ */
1518
+ async setMyName(options) {
1519
+ return this.client.raw.setMyName({
1520
+ ...options
1521
+ });
1522
+ }
1523
+ /**
1524
+ * Use this method to get the current bot name for a given user language.
1525
+ * Returns [BotName](https://core.telegram.org/bots/api#botname) on success.
1526
+ *
1527
+ * @param options Additional parameters (`language_code`)
1528
+ * @returns `BotName` object on success
1529
+ */
1530
+ async getMyName(options) {
1531
+ return this.client.raw.getMyName({
1532
+ ...options
1533
+ });
1534
+ }
1535
+ /**
1536
+ * Use this method to change the bot's description, which is displayed in the chat with the bot if the chat is empty.
1537
+ * Returns `True` on success.
1538
+ *
1539
+ * @param options Additional parameters (description, language_code)
1540
+ * @returns `True` on success
1541
+ */
1542
+ async setMyDescription(options) {
1543
+ return this.client.raw.setMyDescription({
1544
+ ...options
1545
+ });
1546
+ }
1547
+ /**
1548
+ * Use this method to get the current bot description for a given user language.
1549
+ * Returns `BotDescription` on success.
1550
+ *
1551
+ * @param options Additional parameters (`language_code`)
1552
+ * @returns `BotDescription` object on success
1553
+ */
1554
+ async getMyDescription(options) {
1555
+ return this.client.raw.getMyDescription({
1556
+ ...options
1557
+ });
1558
+ }
1559
+ /**
1560
+ * Use this method to change the bot's short description, which is displayed on the bot's profile page and sent with a link when users share the bot.
1561
+ * Returns `True` on success.
1562
+ *
1563
+ * @param options Additional parameters (short_description, language_code)
1564
+ * @returns `True` on success
1565
+ */
1566
+ async setMyShortDescription(options) {
1567
+ return this.client.raw.setMyShortDescription({
1568
+ ...options
1569
+ });
1570
+ }
1571
+ /**
1572
+ * Use this method to get the current bot short description for a given user language.
1573
+ * Returns `BotShortDescription` on success.
1574
+ *
1575
+ * @param options Additional parameters (`language_code`)
1576
+ * @returns `BotShortDescription` object on success
1577
+ */
1578
+ async getMyShortDescription(options) {
1579
+ return this.client.raw.getMyShortDescription({
1580
+ ...options
1581
+ });
1582
+ }
1583
+ /**
1584
+ * Use this method to change the bot's profile photo.
1585
+ * Returns `True` on success.
1586
+ *
1587
+ * @param photo Bot profile photo
1588
+ * @returns `True` on success
1589
+ */
1590
+ async setMyProfilePhoto(photo) {
1591
+ return this.client.raw.setMyProfilePhoto({
1592
+ photo
1593
+ });
1594
+ }
1595
+ /**
1596
+ * Use this method to delete the bot's profile photo.
1597
+ * Returns `True` on success.
1598
+ *
1599
+ * @returns `True` on success
1600
+ */
1601
+ async removeMyProfilePhoto() {
1602
+ return this.client.raw.removeMyProfilePhoto();
1603
+ }
1604
+ /**
1605
+ * Use this method to change the bot's menu button in a private chat or the default menu button.
1606
+ * Returns `True` on success.
1607
+ *
1608
+ * @param options Additional parameters (chat_id, menu_button)
1609
+ * @returns `True` on success
1610
+ */
1611
+ async setChatMenuButton(options) {
1612
+ return this.client.raw.setChatMenuButton({
1613
+ ...options
1614
+ });
1615
+ }
1616
+ /**
1617
+ * Use this method to get the current value of the bot's menu button in a private chat or the default menu button.
1618
+ * Returns `MenuButton` on success.
1619
+ *
1620
+ * @param chat_id Chat identifier
1621
+ * @returns `MenuButton` object on success
1622
+ */
1623
+ async getChatMenuButton(chat_id) {
1624
+ return this.client.raw.getChatMenuButton({
1625
+ chat_id
1626
+ });
1627
+ }
1628
+ /**
1629
+ * Use this method to change the default administrator rights requested by the bot when it is added as an administrator to groups or channels.
1630
+ * These rights will be proposed to users, but they can change the list before adding the bot.
1631
+ * Returns `True` on success.
1632
+ *
1633
+ * @param options Additional parameters (rights, for_channels)
1634
+ * @returns `True` on success
1635
+ */
1636
+ async setMyDefaultAdministratorRights(options) {
1637
+ return this.client.raw.setMyDefaultAdministratorRights({
1638
+ ...options
1639
+ });
1640
+ }
1641
+ /**
1642
+ * Use this method to get the bot's current default administrator rights.
1643
+ * Returns `ChatAdministratorRights` on success.
1644
+ *
1645
+ * @param options Additional parameters (for_channels)
1646
+ * @returns `ChatAdministratorRights` object on success
1647
+ */
1648
+ async getMyDefaultAdministratorRights(options) {
1649
+ return this.client.raw.getMyDefaultAdministratorRights({
1650
+ ...options
1651
+ });
1652
+ }
1653
+ /**
1654
+ * Returns a list of gifts that the bot can send to users and channel chats.
1655
+ * No parameters required.
1656
+ * Returns a `Gifts` object on success.
1657
+ *
1658
+ * @returns `Gifts` object on success
1659
+ */
1660
+ async getAvailableGifts() {
1661
+ return this.client.raw.getAvailableGifts();
1662
+ }
1663
+ /**
1664
+ * Sends a gift to a specified user or channel chat.
1665
+ * The recipient cannot convert the gift into Telegram Stars.
1666
+ * Returns `True` on success.
1667
+ *
1668
+ * @param gift_id Unique gift identifier
1669
+ * @param options Additional parameters (chat_id, gift_item_name, user_id)
1670
+ * @returns `True` on success
1671
+ */
1672
+ async sendGift(gift_id, options) {
1673
+ return this.client.raw.sendGift({
1674
+ gift_id,
1675
+ ...options
1676
+ });
1677
+ }
1678
+ /**
1679
+ * Gifts a Telegram Premium subscription to a specified user.
1680
+ * Returns `True` on success.
1681
+ *
1682
+ * @param user_id User identifier
1683
+ * @param month_count Number of subscription months
1684
+ * @param star_count Number of stars
1685
+ * @returns `True` on success
1686
+ */
1687
+ async giftPremiumSubscription(user_id, month_count, star_count, options) {
1688
+ return this.client.raw.giftPremiumSubscription({
1689
+ user_id,
1690
+ month_count,
1691
+ star_count,
1692
+ ...options
1693
+ });
1694
+ }
1695
+ /**
1696
+ * Verifies a user [on behalf of an organization](https://telegram.org/verify#third-party-verification) represented by the bot.
1697
+ * Returns `True` on success.
1698
+ *
1699
+ * @param user_id User identifier
1700
+ * @param options Additional parameters (status, comment)
1701
+ * @returns `True` on success
1702
+ */
1703
+ async verifyUser(user_id, options) {
1704
+ return this.client.raw.verifyUser({
1705
+ user_id,
1706
+ ...options
1707
+ });
1708
+ }
1709
+ /**
1710
+ * Verifies a chat [on behalf of an organization](https://telegram.org/verify#third-party-verification) represented by the bot.
1711
+ * Returns `True` on success.
1712
+ *
1713
+ * @param chat_id Chat identifier
1714
+ * @param options Additional parameters (custom_description)
1715
+ * @returns `True` on success
1716
+ */
1717
+ async verifyChat(chat_id, options) {
1718
+ return this.client.raw.verifyChat({
1719
+ chat_id,
1720
+ ...options
1721
+ });
1722
+ }
1723
+ /**
1724
+ * Revokes a user verification established by the bot [on behalf of an organization](https://telegram.org/verify#third-party-verification).
1725
+ * Returns `True` on success.
1726
+ *
1727
+ * @param user_id User identifier
1728
+ * @returns `true` on success
1729
+ */
1730
+ async removeUserVerification(user_id) {
1731
+ return this.client.raw.removeUserVerification({ user_id });
1732
+ }
1733
+ /**
1734
+ * Revokes a chat verification established by the bot [on behalf of an organization](https://telegram.org/verify#third-party-verification).
1735
+ * Returns `True` on success.
1736
+ *
1737
+ * @param chat_id Chat identifier
1738
+ * @returns `True` on success
1739
+ */
1740
+ async removeChatVerification(chat_id) {
1741
+ return this.client.raw.removeChatVerification({
1742
+ chat_id
1743
+ });
1744
+ }
1745
+ /**
1746
+ * Marks an incoming message as read on behalf of a business account.
1747
+ * Requires the business bot right `can_read_messages`.
1748
+ * Returns `True` on success.
1749
+ *
1750
+ * @param business_connection_id Business account identifier
1751
+ * @param chat_id Chat identifier
1752
+ * @param message_id Message identifier
1753
+ * @returns `True` on success
1754
+ */
1755
+ async readBusinessMessage(business_connection_id, chat_id, message_id) {
1756
+ return this.client.raw.readBusinessMessage({
1757
+ business_connection_id,
1758
+ chat_id,
1759
+ message_id
1760
+ });
1761
+ }
1762
+ /**
1763
+ * Deletes messages on behalf of a business account.
1764
+ * Requires the business bot right `can_delete_sent_messages` to delete messages sent by the bot itself, or `can_delete_all_messages` to delete any message.
1765
+ * Returns `True` on success.
1766
+ *
1767
+ * @param business_connection_id Business account identifier
1768
+ * @param message_ids Message identifiers
1769
+ * @returns `True` on success
1770
+ */
1771
+ async deleteBusinessMessages(business_connection_id, message_ids) {
1772
+ return this.client.raw.deleteBusinessMessages({
1773
+ business_connection_id,
1774
+ message_ids
1775
+ });
1776
+ }
1777
+ /**
1778
+ * Changes the first and last name of a managed business account.
1779
+ * Requires the business bot right `can_change_name`.
1780
+ * Returns `True` on success.
1781
+ *
1782
+ * @param business_connection_id Business account identifier
1783
+ * @param first_name New first name of the managed business account
1784
+ * @param options Additional parameters (last_name)
1785
+ * @returns `True` on success
1786
+ */
1787
+ async setBusinessAccountName(business_connection_id, first_name, options) {
1788
+ return this.client.raw.setBusinessAccountName({
1789
+ business_connection_id,
1790
+ first_name,
1791
+ ...options
1792
+ });
1793
+ }
1794
+ /**
1795
+ * Changes the username of a managed business account.
1796
+ * Requires the business bot right `can_change_username`.
1797
+ * On success, returns `True`.
1798
+ *
1799
+ * @param business_connection_id Business account identifier
1800
+ * @param options Additional parameters (username)
1801
+ * @returns `True` on success
1802
+ */
1803
+ async setBusinessAccountUsername(business_connection_id, options) {
1804
+ return this.client.raw.setBusinessAccountUsername({
1805
+ business_connection_id,
1806
+ ...options
1807
+ });
1808
+ }
1809
+ /**
1810
+ * Changes the bio of a managed business account.
1811
+ * Requires the business bot right `can_change_bio`.
1812
+ * Returns `True` on success.
1813
+ *
1814
+ * @param business_connection_id Business account identifier
1815
+ * @param options Additional parameters (bio)
1816
+ * @returns `True` on success
1817
+ */
1818
+ async setBusinessAccountBio(business_connection_id, options) {
1819
+ return this.client.raw.setBusinessAccountBio({
1820
+ business_connection_id,
1821
+ ...options
1822
+ });
1823
+ }
1824
+ /**
1825
+ * Changes the profile photo of a managed business account.
1826
+ * Requires the business bot right `can_edit_profile_photo`.
1827
+ * Returns `True` on success.
1828
+ *
1829
+ * @param business_connection_id Business account identifier
1830
+ * @param photo Managed business account photo
1831
+ * @param options Additional parameters (photo)
1832
+ * @returns `True` on success
1833
+ */
1834
+ async setBusinessAccountProfilePhoto(business_connection_id, photo, options) {
1835
+ return this.client.raw.setBusinessAccountProfilePhoto({
1836
+ business_connection_id,
1837
+ photo,
1838
+ ...options
1839
+ });
1840
+ }
1841
+ /**
1842
+ * Deletes the current profile photo of a managed business account.
1843
+ * Requires the business bot right `can_edit_profile_photo`.
1844
+ * Returns `True` on success.
1845
+ *
1846
+ * @param business_connection_id Business account identifier
1847
+ * @returns `True` on success
1848
+ */
1849
+ async removeBusinessAccountProfilePhoto(business_connection_id, options) {
1850
+ return this.client.raw.removeBusinessAccountProfilePhoto({
1851
+ business_connection_id,
1852
+ ...options
1853
+ });
1854
+ }
1855
+ /**
1856
+ * Changes the privacy settings regarding incoming gifts in a managed business account.
1857
+ * Requires the business bot right `can_change_gift_settings`.
1858
+ * Returns `True` on success.
1859
+ *
1860
+ * @param business_connection_id Business account identifier
1861
+ * @param show_gift_button Show gift button
1862
+ * @param accepted_gift_types Accepted gift types
1863
+ * @returns `True` on success
1864
+ */
1865
+ async setBusinessAccountGiftSettings(business_connection_id, show_gift_button, accepted_gift_types) {
1866
+ return this.client.raw.setBusinessAccountGiftSettings({
1867
+ business_connection_id,
1868
+ show_gift_button,
1869
+ accepted_gift_types
1870
+ });
1871
+ }
1872
+ /**
1873
+ * Returns the number of Telegram Stars belonging to a managed business account.
1874
+ * Requires the business bot right `can_view_gifts_and_stars`.
1875
+ * Returns `StarAmount` on success.
1876
+ *
1877
+ * @param business_connection_id Business account identifier
1878
+ * @returns Number of stars
1879
+ */
1880
+ async getBusinessAccountStarBalance(business_connection_id) {
1881
+ return this.client.raw.getBusinessAccountStarBalance({
1882
+ business_connection_id
1883
+ });
1884
+ }
1885
+ /**
1886
+ * Transfers Telegram Stars from a business account balance to the bot balance.
1887
+ * Requires the business bot right `can_transfer_stars`.
1888
+ * Returns `True` on success.
1889
+ *
1890
+ * @param business_connection_id Business account identifier
1891
+ * @param star_count Number of stars to transfer
1892
+ * @returns `True` on success
1893
+ */
1894
+ async transferBusinessAccountStars(business_connection_id, star_count) {
1895
+ return this.client.raw.transferBusinessAccountStars({
1896
+ business_connection_id,
1897
+ star_count
1898
+ });
1899
+ }
1900
+ /**
1901
+ * Returns received gifts belonging to a managed business account.
1902
+ * Requires the business bot right `can_view_gifts_and_stars`.
1903
+ * Returns `OwnedGifts` on success.
1904
+ *
1905
+ * @param business_connection_id Business account identifier
1906
+ * @param options Additional parameters
1907
+ * @returns Received gifts
1908
+ */
1909
+ async getBusinessAccountGifts(business_connection_id, options) {
1910
+ return this.client.raw.getBusinessAccountGifts({
1911
+ business_connection_id,
1912
+ ...options
1913
+ });
1914
+ }
1915
+ /**
1916
+ * Returns gifts owned and displayed by a user.
1917
+ * Returns `OwnedGifts` on success.
1918
+ *
1919
+ * @param user_id User identifier
1920
+ * @param options Additional parameters
1921
+ * @returns Received gifts
1922
+ */
1923
+ async getUserGifts(user_id, options) {
1924
+ return this.client.raw.getUserGifts({
1925
+ user_id,
1926
+ ...options
1927
+ });
1928
+ }
1929
+ /**
1930
+ * Returns gifts belonging to a chat.
1931
+ * Returns `OwnedGifts` on success.
1932
+ *
1933
+ * @param chat_id Chat identifier with the user
1934
+ * @param options Additional parameters
1935
+ * @returns Received gifts
1936
+ */
1937
+ async getChatGifts(chat_id, options) {
1938
+ return this.client.raw.getChatGifts({
1939
+ chat_id,
1940
+ ...options
1941
+ });
1942
+ }
1943
+ /**
1944
+ * Converts a regular gift into Telegram Stars.
1945
+ * Requires the business bot right `can_convert_gifts_to_stars`.
1946
+ * On success, returns `True`.
1947
+ *
1948
+ * @param business_connection_id Business account identifier
1949
+ * @param owned_gift_id Gift identifier
1950
+ * @returns `True` on success
1951
+ */
1952
+ async convertGiftToStars(business_connection_id, owned_gift_id) {
1953
+ return this.client.raw.convertGiftToStars({
1954
+ business_connection_id,
1955
+ owned_gift_id
1956
+ });
1957
+ }
1958
+ /**
1959
+ * Upgrades a regular gift to a unique one.
1960
+ * Requires the business bot right `can_transfer_and_upgrade_gifts`.
1961
+ * Additionally requires the business bot right `can_transfer_stars` if the upgrade is paid.
1962
+ * Returns `True` on success.
1963
+ *
1964
+ * @param business_connection_id Business account identifier
1965
+ * @param owned_gift_id Gift identifier
1966
+ * @returns `True` on success
1967
+ */
1968
+ async upgradeGift(business_connection_id, owned_gift_id, options) {
1969
+ return this.client.raw.upgradeGift({
1970
+ business_connection_id,
1971
+ owned_gift_id,
1972
+ ...options
1973
+ });
1974
+ }
1975
+ /**
1976
+ * Transfers an owned unique gift to another user.
1977
+ * Requires the business bot right `can_transfer_and_upgrade_gifts`.
1978
+ * Requires the business bot right `can_transfer_stars` if the transfer is paid.
1979
+ * Returns `True` on success.
1980
+ *
1981
+ * @param business_connection_id Business account identifier
1982
+ * @param owned_gift_id Gift identifier
1983
+ * @param new_owner_chat_id New owner's chat identifier
1984
+ * @param options Additional parameters
1985
+ * @returns `True` on success
1986
+ */
1987
+ async transferGift(business_connection_id, owned_gift_id, new_owner_chat_id, options) {
1988
+ return this.client.raw.transferGift({
1989
+ business_connection_id,
1990
+ owned_gift_id,
1991
+ new_owner_chat_id,
1992
+ ...options
1993
+ });
1994
+ }
1995
+ /**
1996
+ * Posts a story on behalf of a managed business account.
1997
+ * Requires the business bot right `can_manage_stories`.
1998
+ * Returns `Story` on success.
1999
+ *
2000
+ * @param business_connection_id Unique business connection identifier
2001
+ * @param content Story content
2002
+ * @param active_period Story duration (from 1 to 72 hours)
2003
+ * @param options Additional parameters
2004
+ * @returns `Story` on success
2005
+ */
2006
+ async postStory(business_connection_id, content, active_period, options) {
2007
+ return this.client.raw.postStory({
2008
+ business_connection_id,
2009
+ content,
2010
+ active_period,
2011
+ ...options
2012
+ });
2013
+ }
2014
+ /**
2015
+ * Reposts a story on behalf of a business account from another business account.
2016
+ * Both business accounts must be managed by the same bot, and the story in the source account must be published (or reposted) by the bot.
2017
+ * Requires the business bot right `can_manage_stories` for both business accounts.
2018
+ * Returns `Story` on success.
2019
+ *
2020
+ * @param business_connection_id Business account identifier.
2021
+ * @param from_chat_id Source chat identifier.
2022
+ * @param from_story_id Source story identifier.
2023
+ * @param active_period Story duration.
2024
+ * @param options Additional parameters.
2025
+ * @returns `Story` on success.
2026
+ */
2027
+ async repostStory(business_connection_id, from_chat_id, from_story_id, active_period, options) {
2028
+ return this.client.raw.repostStory({
2029
+ business_connection_id,
2030
+ from_chat_id,
2031
+ from_story_id,
2032
+ active_period,
2033
+ ...options
2034
+ });
2035
+ }
2036
+ /**
2037
+ * Edits a story previously published by the bot on behalf of a managed business account.
2038
+ * Requires the business bot right `can_manage_stories`.
2039
+ * Returns `Story` on success.
2040
+ *
2041
+ * @param business_connection_id Unique business connection identifier
2042
+ * @param story_id Story identifier
2043
+ * @param content Story content
2044
+ * @param options Additional parameters
2045
+ * @returns `Story` on success
2046
+ */
2047
+ async editStory(business_connection_id, story_id, content, options) {
2048
+ return this.client.raw.editStory({
2049
+ business_connection_id,
2050
+ story_id,
2051
+ content,
2052
+ ...options
2053
+ });
2054
+ }
2055
+ /**
2056
+ * Deletes a story previously published by the bot on behalf of a managed business account.
2057
+ * Requires the business bot right `can_manage_stories`.
2058
+ * On success, returns `True`.
2059
+ *
2060
+ * @param business_connection_id Unique business connection identifier
2061
+ * @param story_id Story identifier
2062
+ * @returns `True` on success
2063
+ */
2064
+ async deleteStory(business_connection_id, story_id) {
2065
+ return this.client.raw.deleteStory({
2066
+ business_connection_id,
2067
+ story_id
2068
+ });
2069
+ }
2070
+ /**
2071
+ * Use this method to set the result of an interaction with a web application and send a corresponding message on behalf of the user to the chat from which the query originated.
2072
+ * On success, a `SentWebAppMessage` object is returned.
2073
+ *
2074
+ * @param web_app_query_id Web App query identifier.
2075
+ * @param result Web application interaction result.
2076
+ * @returns `SentWebAppMessage`.
2077
+ */
2078
+ async answerWebAppQuery(web_app_query_id, result) {
2079
+ return this.client.raw.answerWebAppQuery({
2080
+ web_app_query_id,
2081
+ result
2082
+ });
2083
+ }
2084
+ /**
2085
+ * Saves a message that can be sent by a mini-app user.
2086
+ * Returns a `PreparedInlineMessage` object.
2087
+ *
2088
+ * @param user_id User identifier
2089
+ * @param result Inline query result
2090
+ * @returns `PreparedInlineMessage` with the prepared message ID
2091
+ */
2092
+ async savePreparedInlineMessage(user_id, result, options) {
2093
+ return this.client.raw.savePreparedInlineMessage({
2094
+ user_id,
2095
+ result,
2096
+ ...options
2097
+ });
2098
+ }
2099
+ /**
2100
+ * Saves a keyboard button that can be used by a mini-app user.
2101
+ * Returns a `PreparedKeyboardButton` object.
2102
+ *
2103
+ * @param user_id User identifier
2104
+ * @param button Keyboard button
2105
+ * @returns `PreparedKeyboardButton` with the prepared button ID
2106
+ */
2107
+ async savePreparedKeyboardButton(user_id, button) {
2108
+ return this.client.raw.savePreparedKeyboardButton({
2109
+ user_id,
2110
+ button
2111
+ });
2112
+ }
2113
+ /**
2114
+ * Helper method for normalizing message ID when editing.
2115
+ */
2116
+ getEditIds(id) {
2117
+ return typeof id === 'string'
2118
+ ? { inline_message_id: id }
2119
+ : { chat_id: id.chat_id, message_id: id.message_id };
2120
+ }
2121
+ /**
2122
+ * Edits a text message or inline message text.
2123
+ *
2124
+ * @param id Message identifier (either chat_id and message_id, or inline_message_id)
2125
+ * @param text New message text
2126
+ * @param options Additional parameters
2127
+ * @returns Edited message
2128
+ */
2129
+ async editMessageText(id, text, options) {
2130
+ return this.client.raw.editMessageText({
2131
+ ...this.getEditIds(id),
2132
+ text,
2133
+ ...options
2134
+ });
2135
+ }
2136
+ /**
2137
+ * Use this method to edit message captions.
2138
+ * On success, if the edited message is not an inline message, the edited message is returned, otherwise `True` is returned.
2139
+ * Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours of being sent.
2140
+ *
2141
+ * @param id Message identifier (either chat_id and message_id, or inline_message_id)
2142
+ * @param options Additional parameters (caption, parse_mode, etc.)
2143
+ * @returns Edited message or `True` if editing was successful
2144
+ */
2145
+ async editMessageCaption(id, options) {
2146
+ return this.client.raw.editMessageCaption({
2147
+ ...this.getEditIds(id),
2148
+ ...options
2149
+ });
2150
+ }
2151
+ /**
2152
+ * Use this method to edit animation, audio, document, photo, or video messages, or to add media files to text messages.
2153
+ * If a message is part of a message album, it can only be edited as audio for audio albums, only as a document for document albums, and as a photo or video in other cases.
2154
+ * When editing an inline message, a new file cannot be uploaded; use a previously uploaded file via its `file_id` or specify a URL.
2155
+ * On success, if the edited message is not an inline message, the edited message is returned, otherwise `True` is returned.
2156
+ * Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours of being sent.
2157
+ *
2158
+ * @param id Message identifier. Can be an object with `chat_id` and `message_id` or an `inline_message_id` string.
2159
+ * @param options Media message editing parameters. Must include `media` (InputMediaVideo/InputMediaAnimation/InputMediaAudio/InputMediaPhoto).
2160
+ * @returns Edited message or `True` on success.
2161
+ */
2162
+ async editMessageMedia(id, media, options) {
2163
+ return this.client.raw.editMessageMedia({
2164
+ ...this.getEditIds(id),
2165
+ media,
2166
+ ...options
2167
+ });
2168
+ }
2169
+ /**
2170
+ * Use this method to edit live location messages.
2171
+ * A location can be edited until its `live_period` expires or editing is explicitly prohibited by calling `stopMessageLiveLocation`.
2172
+ * On success, if the edited message is not an inline message, the edited `Message` is returned, otherwise `True` is returned.
2173
+ *
2174
+ * @param id Message identifier. Can be an object with `chat_id` and `message_id` or an `inline_message_id` string.
2175
+ * @param latitude New location latitude
2176
+ * @param longitude New location longitude
2177
+ * @param options Additional parameters
2178
+ * @returns Edited message or `True` on success.
2179
+ */
2180
+ async editMessageLiveLocation(id, latitude, longitude, options) {
2181
+ return this.client.raw.editMessageLiveLocation({
2182
+ ...this.getEditIds(id),
2183
+ latitude,
2184
+ longitude,
2185
+ ...options
2186
+ });
2187
+ }
2188
+ /**
2189
+ * Use this method to stop updating a live location message before `live_period` expires.
2190
+ * On success, if the message is not an inline message, the edited message is returned, otherwise `True` is returned.
2191
+ *
2192
+ * @param id Message identifier. Can be an object with `chat_id` and `message_id` or an `inline_message_id` string.
2193
+ * @param options Additional parameters
2194
+ * @returns Edited message or `True` on success.
2195
+ */
2196
+ async stopMessageLiveLocation(id, options) {
2197
+ return this.client.raw.stopMessageLiveLocation({
2198
+ ...this.getEditIds(id),
2199
+ ...options
2200
+ });
2201
+ }
2202
+ /**
2203
+ * Use this method to edit a checklist on behalf of a connected business account.
2204
+ * On success, the edited message is returned.
2205
+ *
2206
+ * @param business_connection_id Business connection identifier.
2207
+ * @param chat_id Chat identifier.
2208
+ * @param message_id Message identifier.
2209
+ * @param checklist New checklist.
2210
+ * @param options Additional parameters
2211
+ * @returns Edited message on success.
2212
+ */
2213
+ async editMessageChecklist(business_connection_id, chat_id, message_id, checklist, options) {
2214
+ return this.client.raw.editMessageChecklist({
2215
+ business_connection_id,
2216
+ chat_id,
2217
+ message_id,
2218
+ checklist,
2219
+ ...options
2220
+ });
2221
+ }
2222
+ /**
2223
+ * Use this method to edit only the reply markup of messages.
2224
+ * On success, if the edited message is not an inline message, the edited message is returned, otherwise `True` is returned.
2225
+ * Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours of being sent.
2226
+ *
2227
+ * @param id Message identifier. Can be an object with `chat_id` and `message_id` or an `inline_message_id` string.
2228
+ * @param options Additional parameters.
2229
+ * @returns Edited message or `True` on success.
2230
+ */
2231
+ async editMessageReplyMarkup(id, options) {
2232
+ return this.client.raw.editMessageReplyMarkup({
2233
+ ...this.getEditIds(id),
2234
+ ...options
2235
+ });
2236
+ }
2237
+ /**
2238
+ * Use this method to stop a poll.
2239
+ * On success, the updated poll is returned.
2240
+ *
2241
+ * @param chat_id Chat identifier or username.
2242
+ * @param message_id Message identifier with the poll.
2243
+ * @param options Additional parameters.
2244
+ * @returns Updated poll.
2245
+ */
2246
+ async stopPoll(chat_id, message_id, options) {
2247
+ return this.client.raw.stopPoll({
2248
+ chat_id,
2249
+ message_id,
2250
+ ...options
2251
+ });
2252
+ }
2253
+ /**
2254
+ * Use this method to approve a suggested post in a direct message chat.
2255
+ * The bot must have the `can_post_messages` administrator right in the corresponding channel chat.
2256
+ * Returns `True` on success.
2257
+ *
2258
+ * @param chat_id Chat identifier or username.
2259
+ * @param message_id Suggested post identifier.
2260
+ * @returns `True` on success.
2261
+ */
2262
+ async approveSuggestedPost(chat_id, message_id, options) {
2263
+ return this.client.raw.approveSuggestedPost({
2264
+ chat_id,
2265
+ message_id,
2266
+ ...options
2267
+ });
2268
+ }
2269
+ /**
2270
+ * Use this method to decline a suggested post in a direct message chat.
2271
+ * The bot must have the `can_manage_direct_messages` administrator right in the corresponding channel chat.
2272
+ * Returns `True` on success.
2273
+ *
2274
+ * @param chat_id Chat identifier.
2275
+ * @param message_id Suggested post identifier.
2276
+ * @returns `True` on success.
2277
+ */
2278
+ async declineSuggestedPost(chat_id, message_id, options) {
2279
+ return this.client.raw.declineSuggestedPost({
2280
+ chat_id,
2281
+ message_id,
2282
+ ...options
2283
+ });
2284
+ }
2285
+ /**
2286
+ * Use this method to delete a message, including service messages, with the following restrictions:
2287
+ * - A message can only be deleted if it was sent less than 48 hours ago.
2288
+ * - Service messages about creating a supergroup, channel, or forum topic cannot be deleted.
2289
+ * - A `dice` message in a private chat can only be deleted if it was sent more than 24 hours ago.
2290
+ * - Bots can delete outgoing messages in private chats, groups, and supergroups.
2291
+ * - Bots can delete incoming messages in private chats.
2292
+ * - Bots granted the `can_post_messages` permission can delete outgoing messages in channels.
2293
+ * - If the bot is a group administrator, it can delete any message there.
2294
+ * - If the bot has the `can_delete_messages` administrator right in a supergroup or channel, it can delete any message there.
2295
+ * - If the bot has the `can_manage_direct_messages` administrator right in a channel, it can delete any message in the corresponding direct message chat.
2296
+ * Returns `True` on success.
2297
+ *
2298
+ * @param chat_id Chat identifier or username.
2299
+ * @param message_id Message identifier.
2300
+ * @returns `True` on success.
2301
+ */
2302
+ async deleteMessage(chat_id, message_id) {
2303
+ return this.client.raw.deleteMessage({
2304
+ chat_id,
2305
+ message_id,
2306
+ });
2307
+ }
2308
+ /**
2309
+ * Use this method to delete multiple messages at once.
2310
+ * If some of the specified messages cannot be found, they are skipped.
2311
+ * Returns `True` on success.
2312
+ *
2313
+ * @param chat_id Chat identifier or username.
2314
+ * @param message_ids Message identifiers.
2315
+ * @returns `True` on success.
2316
+ */
2317
+ async deleteMessages(chat_id, message_ids) {
2318
+ return this.client.raw.deleteMessages({
2319
+ chat_id,
2320
+ message_ids,
2321
+ });
2322
+ }
2323
+ /**
2324
+ * Use this method to send static `.WEBP`, animated `.TGS`, or video `.WEBM` stickers.
2325
+ * On success, the sent message is returned.
2326
+ *
2327
+ * @param chat_id Chat identifier or username.
2328
+ * @param sticker Sticker to send. Can be `file_id`, `url`, or `InputFile`.
2329
+ * @param options Additional parameters.
2330
+ * @returns Sent message.
2331
+ */
2332
+ async sendSticker(chat_id, sticker, options) {
2333
+ return this.client.raw.sendSticker({
2334
+ chat_id,
2335
+ sticker,
2336
+ ...options
2337
+ });
2338
+ }
2339
+ /**
2340
+ * Use this method to get a sticker set.
2341
+ * On success, a `StickerSet` object is returned.
2342
+ *
2343
+ * @param name Sticker set name.
2344
+ * @returns `StickerSet`.
2345
+ */
2346
+ async getStickerSet(name) {
2347
+ return this.client.raw.getStickerSet({ name });
2348
+ }
2349
+ /**
2350
+ * Use this method to get information about custom emoji stickers by their identifiers.
2351
+ * Returns an array of `Sticker` objects.
2352
+ *
2353
+
2354
+ * @param custom_emoji_ids Sticker identifiers.
2355
+ * @returns Array of `Sticker` objects.
2356
+ */
2357
+ async getCustomEmojiStickers(custom_emoji_ids) {
2358
+ return this.client.raw.getCustomEmojiStickers({ custom_emoji_ids });
2359
+ }
2360
+ /**
2361
+ * Use this method to upload a sticker file for subsequent use in `createNewStickerSet`, `addStickerToSet`, or `replaceStickerInSet` methods (the file can be used multiple times).
2362
+ * Returns the uploaded file on success.
2363
+ *
2364
+ * @param user_id User identifier.
2365
+ * @param sticker Sticker to upload. Can be a `string` (file_id) or `InputFile`.
2366
+ * @param sticker_format Sticker format. Can be `'static'`, `'animated'`, or `'video'`.
2367
+ * @returns `File` object.
2368
+ */
2369
+ async uploadStickerFile(user_id, sticker, sticker_format) {
2370
+ return this.client.raw.uploadStickerFile({ user_id, sticker, sticker_format });
2371
+ }
2372
+ /**
2373
+ * Use this method to create a new sticker set belonging to a user.
2374
+ * The bot will be able to edit a sticker set created this way.
2375
+ * Returns `True` on success.
2376
+ *
2377
+ * @param user_id User identifier.
2378
+ * @param name Sticker set name. Must start with `a-z`, `A-Z`, or `0-9`, and can contain `_` and consist of no more than 64 characters.
2379
+ * @param title Sticker set title. Must consist of no more than 64 characters.
2380
+ * @param stickers Array of stickers to add. At least one sticker must be passed.
2381
+ * @param options Additional parameters.
2382
+ * @returns `True` on success.
2383
+ */
2384
+ async createNewStickerSet(user_id, name, title, stickers, options) {
2385
+ return this.client.raw.createNewStickerSet({
2386
+ user_id,
2387
+ name,
2388
+ title,
2389
+ stickers,
2390
+ ...options
2391
+ });
2392
+ }
2393
+ /**
2394
+ * Use this method to add a new sticker to a sticker set.
2395
+ * Returns `True` on success.
2396
+ *
2397
+ * @param user_id User identifier creating the sticker set.
2398
+ * @param name Sticker set name.
2399
+ * @param sticker Sticker to add. Must be an `InputSticker` object.
2400
+ * @returns `True` on success.
2401
+ */
2402
+ async addStickerToSet(user_id, name, sticker) {
2403
+ return this.client.raw.addStickerToSet({
2404
+ user_id,
2405
+ name,
2406
+ sticker
2407
+ });
2408
+ }
2409
+ /**
2410
+ * Use this method to move a sticker from a set created by the bot to a specific position.
2411
+ * Returns `True` on success.
2412
+ *
2413
+ * @param sticker Sticker identifier.
2414
+ * @param position New sticker position.
2415
+ * @returns `True` on success.
2416
+ */
2417
+ async setStickerPositionInSet(sticker, position) {
2418
+ return this.client.raw.setStickerPositionInSet({
2419
+ sticker,
2420
+ position
2421
+ });
2422
+ }
2423
+ /**
2424
+ * Use this method to delete a sticker from a sticker set.
2425
+ * Returns `True` on success.
2426
+ *
2427
+ * @param sticker Sticker identifier.
2428
+ * @returns `True` on success.
2429
+ */
2430
+ async deleteStickerFromSet(sticker) {
2431
+ return this.client.raw.deleteStickerFromSet({
2432
+ sticker
2433
+ });
2434
+ }
2435
+ /**
2436
+ * Use this method to replace a sticker in a sticker set.
2437
+ * Returns `True` on success.
2438
+ *
2439
+ * @param user_id User identifier creating the sticker set.
2440
+ * @param name Sticker set name.
2441
+ * @param old_sticker Identifier of the sticker to be replaced.
2442
+ * @param sticker New sticker. Must be an `InputSticker` object.
2443
+ * @returns `True` on success.
2444
+ */
2445
+ async replaceStickerInSet(user_id, name, old_sticker, sticker) {
2446
+ return this.client.raw.replaceStickerInSet({
2447
+ user_id,
2448
+ name,
2449
+ old_sticker,
2450
+ sticker
2451
+ });
2452
+ }
2453
+ /**
2454
+ * Use this method to change the list of emojis assigned to a regular or custom emoji sticker.
2455
+ * The sticker must belong to a sticker set created by the bot.
2456
+ * Returns `True` on success.
2457
+ *
2458
+ * @param sticker Sticker identifier.
2459
+ * @param emoji_list List of emojis.
2460
+ * @returns `True` on success.
2461
+ */
2462
+ async setStickerEmojiList(sticker, emoji_list) {
2463
+ return this.client.raw.setStickerEmojiList({
2464
+ sticker,
2465
+ emoji_list
2466
+ });
2467
+ }
2468
+ /**
2469
+ * Use this method to change the list of keywords assigned to a regular or custom emoji sticker.
2470
+ * The sticker must belong to a sticker set created by the bot.
2471
+ * Returns `True` on success.
2472
+ *
2473
+ * @param sticker Sticker identifier.
2474
+ * @param keywords List of keywords.
2475
+ * @returns `True` on success.
2476
+ */
2477
+ async setStickerKeywords(sticker, keywords) {
2478
+ return this.client.raw.setStickerKeywords({
2479
+ sticker,
2480
+ keywords
2481
+ });
2482
+ }
2483
+ /**
2484
+ * Use this method to change the mask position of a sticker.
2485
+ * The sticker must belong to a set created by the bot.
2486
+ * Returns `True` on success.
2487
+ *
2488
+ * @param sticker Sticker identifier.
2489
+ * @param options Additional parameters.
2490
+ * @returns `True` on success.
2491
+ */
2492
+ async setStickerMaskPosition(sticker, options) {
2493
+ return this.client.raw.setStickerMaskPosition({
2494
+ sticker,
2495
+ ...options
2496
+ });
2497
+ }
2498
+ /**
2499
+ * Use this method to set the title of a created sticker set.
2500
+ * Returns `True` on success.
2501
+ *
2502
+ * @param name Sticker set name.
2503
+ * @param title New sticker set title.
2504
+ * @returns `True` on success.
2505
+ */
2506
+ async setStickerSetTitle(name, title) {
2507
+ return this.client.raw.setStickerSetTitle({
2508
+ name,
2509
+ title
2510
+ });
2511
+ }
2512
+ /**
2513
+ * Use this method to set the thumbnail of a regular sticker set or a mask set.
2514
+ * The thumbnail file format must match the format of the stickers in the set.
2515
+ * Returns `True` on success.
2516
+ *
2517
+ * @param name Sticker set name.
2518
+ * @param user_id User identifier creating the sticker set.
2519
+ * @param format Thumbnail file format.
2520
+ * @param options Additional parameters.
2521
+ * @returns `True` on success.
2522
+ */
2523
+ async setStickerSetThumbnail(name, user_id, format, options) {
2524
+ return this.client.raw.setStickerSetThumbnail({
2525
+ name,
2526
+ user_id,
2527
+ format,
2528
+ ...options
2529
+ });
2530
+ }
2531
+ /**
2532
+ * Use this method to set the thumbnail of a custom emoji sticker set.
2533
+ * Returns `True` on success.
2534
+ *
2535
+ * @param name Sticker set name.
2536
+ * @param custom_emoji_id Emoji identifier.
2537
+ * @returns `True` on success.
2538
+ */
2539
+ async setCustomEmojiStickerSetThumbnail(name, custom_emoji_id) {
2540
+ return this.client.raw.setCustomEmojiStickerSetThumbnail({
2541
+ name,
2542
+ custom_emoji_id
2543
+ });
2544
+ }
2545
+ /**
2546
+ * Use this method to delete a sticker set created by the bot.
2547
+ * Returns `True` on success.
2548
+ *
2549
+ * @param name Sticker set name.
2550
+ * @returns `True` on success.
2551
+ */
2552
+ async deleteStickerSet(name) {
2553
+ return this.client.raw.deleteStickerSet({
2554
+ name
2555
+ });
2556
+ }
2557
+ /**
2558
+ * Use this method to send answers to an inline query.
2559
+ * Returns `True` on success.
2560
+ * No more than 50 results per query are allowed.
2561
+ *
2562
+ * @param inline_query_id Inline query identifier.
2563
+ * @param results Array of results.
2564
+ * @param options Additional parameters.
2565
+ * @returns `True` on success.
2566
+ */
2567
+ async answerInlineQuery(inline_query_id, results, options) {
2568
+ return this.client.raw.answerInlineQuery({
2569
+ inline_query_id,
2570
+ results,
2571
+ ...options
2572
+ });
2573
+ }
2574
+ /**
2575
+ * Use this method to send invoices.
2576
+ * On success, the sent message is returned.
2577
+ *
2578
+ * @param chat_id Chat identifier.
2579
+ * @param title Invoice title.
2580
+ * @param description Invoice description.
2581
+ * @param payload Internal invoice information.
2582
+ * @param currency Invoice currency.
2583
+ * @param prices Invoice prices.
2584
+ * @param options Additional parameters.
2585
+ * @returns Sent message.
2586
+ */
2587
+ async sendInvoice(chat_id, title, description, payload, currency, prices, options) {
2588
+ return this.client.raw.sendInvoice({
2589
+ chat_id,
2590
+ title,
2591
+ description,
2592
+ payload,
2593
+ currency,
2594
+ prices,
2595
+ ...options
2596
+ });
2597
+ }
2598
+ /**
2599
+ * Use this method to create an invoice link.
2600
+ * On success, returns the created invoice link as a string.
2601
+ *
2602
+ * @param title Invoice title.
2603
+ * @param description Invoice description.
2604
+ * @param payload Internal invoice information.
2605
+ * @param currency Invoice currency.
2606
+ * @param prices Invoice prices.
2607
+ * @param options Additional parameters.
2608
+ * @returns Created invoice link.
2609
+ */
2610
+ async createInvoiceLink(title, description, payload, currency, prices, options) {
2611
+ return this.client.raw.createInvoiceLink({
2612
+ title,
2613
+ description,
2614
+ payload,
2615
+ currency,
2616
+ prices,
2617
+ ...options
2618
+ });
2619
+ }
2620
+ /**
2621
+ * If you sent an invoice with a shipping address request and the `is_flexible` parameter was specified, the Bot API will send the bot an update with the `shipping_query` field.
2622
+ * Use this method to answer shipping queries.
2623
+ * Returns `True` on success.
2624
+ *
2625
+ * @param shipping_query_id Shipping query identifier.
2626
+ * @param ok Whether the response is successful.
2627
+ * @param shipping_options Array of shipping options.
2628
+ * @returns `True` on success.
2629
+ */
2630
+ async answerShippingQuery(shipping_query_id, ok, shipping_options) {
2631
+ return this.client.raw.answerShippingQuery({
2632
+ shipping_query_id,
2633
+ ok,
2634
+ shipping_options
2635
+ });
2636
+ }
2637
+ /**
2638
+ * After a user has confirmed their payment and shipping data, the Bot API sends a final confirmation as an update with the `pre_checkout_query` field.
2639
+ * Use this method to answer such pre-checkout queries.
2640
+ * Returns `True` on success.
2641
+ *
2642
+ * **Note**: The Bot API must receive a response within 10 seconds after sending a pre-checkout query.
2643
+ *
2644
+ * @param pre_checkout_query_id Pre-checkout query identifier.
2645
+ * @param ok Whether the response is successful.
2646
+ * @param options Additional parameters (error_message)
2647
+ * @returns `True` on success.
2648
+ */
2649
+ async answerPreCheckoutQuery(pre_checkout_query_id, ok, options) {
2650
+ return this.client.raw.answerPreCheckoutQuery({
2651
+ pre_checkout_query_id,
2652
+ ok,
2653
+ ...options
2654
+ });
2655
+ }
2656
+ /**
2657
+ * Method to get the current Telegram Stars balance of the bot.
2658
+ * Requires no parameters.
2659
+ * On success, returns a `StarAmount` object.
2660
+ *
2661
+ * @returns `StarAmount` object.
2662
+ */
2663
+ async getMyStarBalance() {
2664
+ return this.client.raw.getMyStarBalance();
2665
+ }
2666
+ /**
2667
+ * Returns the bot's Telegram Star transactions in chronological order.
2668
+ * On success, returns a `StarTransactions` object.
2669
+ *
2670
+ * @param options Parameters for filtering transactions.
2671
+ * @returns `StarTransactions` object with transaction information.
2672
+ */
2673
+ async getStarTransactions(options) {
2674
+ return this.client.raw.getStarTransactions({
2675
+ ...options
2676
+ });
2677
+ }
2678
+ /**
2679
+ * Refunds a successful payment in Telegram Stars.
2680
+ * Returns `True` on success.
2681
+ *
2682
+ * @param user_id User identifier.
2683
+ * @param telegram_payment_charge_id Telegram payment transaction identifier.
2684
+ * @returns `True` on success.
2685
+ */
2686
+ async refundStarPayment(user_id, telegram_payment_charge_id) {
2687
+ return this.client.raw.refundStarPayment({ user_id, telegram_payment_charge_id });
2688
+ }
2689
+ /**
2690
+ * Allows the bot to cancel or re-enable the renewal of a subscription paid in Telegram Stars.
2691
+ * Returns `True` on success.
2692
+ *
2693
+ * @param user_id User identifier.
2694
+ * @param telegram_payment_charge_id Telegram payment identifier for the subscription.
2695
+ * @param is_canceled Whether the subscription is canceled.
2696
+ * @returns `True` on success.
2697
+ */
2698
+ async editUserStarSubscription(user_id, telegram_payment_charge_id, is_canceled) {
2699
+ return this.client.raw.editUserStarSubscription({ user_id, telegram_payment_charge_id, is_canceled });
2700
+ }
2701
+ /**
2702
+ * Use this method to send a game.
2703
+ * On success, the sent message is returned.
2704
+ *
2705
+ * @param chat_id Chat identifier.
2706
+ * @param game_short_name Game short name.
2707
+ * @param options Additional parameters.
2708
+ * @returns `Message` object.
2709
+ */
2710
+ async sendGame(chat_id, game_short_name, options) {
2711
+ return this.client.raw.sendGame({
2712
+ chat_id,
2713
+ game_short_name,
2714
+ ...options
2715
+ });
2716
+ }
2717
+ /**
2718
+ * Use this method to set the score of the specified user in a game message.
2719
+ * On success, if the message is not an inline message, the `Message` is returned, otherwise `True` is returned.
2720
+ * Returns an error if the new score is not greater than the user's current score in the chat and `force` is False.
2721
+ *
2722
+ * @param user_id User identifier.
2723
+ * @param score Player's score.
2724
+ * @param options Additional parameters.
2725
+ * @returns `Message` object or `True`.
2726
+ */
2727
+ async setGameScore(user_id, score, options) {
2728
+ return this.client.raw.setGameScore({
2729
+ user_id,
2730
+ score,
2731
+ ...options
2732
+ });
2733
+ }
2734
+ /**
2735
+ * Use this method to get data for high score tables.
2736
+ * Returns the score of the specified user and several of their neighbors in the game.
2737
+ * Returns an array of `GameHighScore` objects.
2738
+ *
2739
+ * This method will currently return scores for the target user, as well as two of their closest neighbors on each side.
2740
+ * It will also return the top three users if the user and their neighbors are not among them.
2741
+ * Note that this behavior is subject to change.
2742
+ *
2743
+ * @param user_id User identifier.
2744
+ * @param options Additional parameters.
2745
+ * @returns Array of `GameHighScore` objects with user score information.
2746
+ */
2747
+ async getGameHighScores(user_id, options) {
2748
+ return this.client.raw.getGameHighScores({
2749
+ user_id,
2750
+ ...options
2751
+ });
2752
+ }
2753
+ }