@zero-bot.net/tg-bot-api 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/telegram.js CHANGED
@@ -3052,6 +3052,1017 @@ class TelegramBot extends EventEmitter {
3052
3052
  return this._request('deleteMessages', { form });
3053
3053
  }
3054
3054
 
3055
+ // ==========================================
3056
+ // Bot API 7.4
3057
+ // ==========================================
3058
+
3059
+ /**
3060
+ * Use this method to issue a refund for a payment made via Telegram Stars.
3061
+ *
3062
+ * @param {Number} userId Identifier of the user whose payment will be refunded
3063
+ * @param {String} telegramPaymentChargeId Telegram payment identifier of the payment to refund
3064
+ * @param {Object} [options] Additional Telegram query options
3065
+ * @return {Promise} On success, True is returned
3066
+ * @see https://core.telegram.org/bots/api#refundstarpayment
3067
+ */
3068
+ refundStarPayment(userId, telegramPaymentChargeId, form = {}) {
3069
+ form.user_id = userId;
3070
+ form.telegram_payment_charge_id = telegramPaymentChargeId;
3071
+ return this._request('refundStarPayment', { form });
3072
+ }
3073
+
3074
+ // ==========================================
3075
+ // Bot API 7.5
3076
+ // ==========================================
3077
+
3078
+ /**
3079
+ * Use this method to get the current status of the balance of Telegram Stars
3080
+ * that can be withdrawn by the bot or transferred to another business account.
3081
+ *
3082
+ * @param {Object} [options] Additional Telegram query options
3083
+ * @return {Promise} On success, returns a StarTransactions object
3084
+ * @see https://core.telegram.org/bots/api#getstartransactions
3085
+ */
3086
+ getStarTransactions(form = {}) {
3087
+ return this._request('getStarTransactions', { form });
3088
+ }
3089
+
3090
+ // ==========================================
3091
+ // Bot API 7.6
3092
+ // ==========================================
3093
+
3094
+ /**
3095
+ * Use this method to send paid media.
3096
+ *
3097
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3098
+ * @param {Number} starCount The number of Telegram Stars that must be paid to buy access to the media
3099
+ * @param {Array} media A JSON-serialized array describing the media to be sent; currently supports photos and videos
3100
+ * @param {Object} [options] Additional Telegram query options
3101
+ * @return {Promise} On success, the sent Message object is returned
3102
+ * @see https://core.telegram.org/bots/api#sendpaidmedia
3103
+ */
3104
+ sendPaidMedia(chatId, starCount, media, form = {}) {
3105
+ form.chat_id = chatId;
3106
+ form.star_count = starCount;
3107
+ form.media = stringify(media);
3108
+ return this._request('sendPaidMedia', { form });
3109
+ }
3110
+
3111
+ // ==========================================
3112
+ // Bot API 7.9
3113
+ // ==========================================
3114
+
3115
+ /**
3116
+ * Use this method to create a subscription invite link for a channel chat.
3117
+ *
3118
+ * @param {Number|String} chatId Unique identifier for the target channel chat or username of the target channel (in the format `@channelusername`)
3119
+ * @param {Object} [options] Additional Telegram query options
3120
+ * @return {Promise} On success, the new invite link as a ChatInviteLink object is returned
3121
+ * @see https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
3122
+ */
3123
+ createChatSubscriptionInviteLink(chatId, form = {}) {
3124
+ form.chat_id = chatId;
3125
+ return this._request('createChatSubscriptionInviteLink', { form });
3126
+ }
3127
+
3128
+ /**
3129
+ * Use this method to edit a subscription invite link created by the bot.
3130
+ *
3131
+ * @param {Number|String} chatId Unique identifier for the target channel chat or username of the target channel (in the format `@channelusername`)
3132
+ * @param {String} inviteLink The invite link to edit
3133
+ * @param {Object} [options] Additional Telegram query options
3134
+ * @return {Promise} On success, the edited invite link as a ChatInviteLink object is returned
3135
+ * @see https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
3136
+ */
3137
+ editChatSubscriptionInviteLink(chatId, inviteLink, form = {}) {
3138
+ form.chat_id = chatId;
3139
+ form.invite_link = inviteLink;
3140
+ return this._request('editChatSubscriptionInviteLink', { form });
3141
+ }
3142
+
3143
+ // ==========================================
3144
+ // Bot API 8.0
3145
+ // ==========================================
3146
+
3147
+ /**
3148
+ * Use this method to get the list of gifts that can be sent by the bot.
3149
+ *
3150
+ * @param {Object} [options] Additional Telegram query options
3151
+ * @return {Promise} On success, returns a Gifts object
3152
+ * @see https://core.telegram.org/bots/api#getavailablegifts
3153
+ */
3154
+ getAvailableGifts(form = {}) {
3155
+ return this._request('getAvailableGifts', { form });
3156
+ }
3157
+
3158
+ /**
3159
+ * Use this method to send a gift to a user.
3160
+ *
3161
+ * @param {Number} userId Unique identifier of the target user that will receive the gift
3162
+ * @param {String} giftId Identifier of the gift
3163
+ * @param {Object} [options] Additional Telegram query options
3164
+ * @return {Promise} On success, True is returned
3165
+ * @see https://core.telegram.org/bots/api#sendgift
3166
+ */
3167
+ sendGift(userId, giftId, form = {}) {
3168
+ form.user_id = userId;
3169
+ form.gift_id = giftId;
3170
+ return this._request('sendGift', { form });
3171
+ }
3172
+
3173
+ /**
3174
+ * Use this method to edit a subscription paid through Telegram Stars.
3175
+ *
3176
+ * @param {Number} userId Identifier of the user whose subscription will be edited
3177
+ * @param {String} telegramPaymentChargeId Telegram payment identifier of the subscription payment
3178
+ * @param {Boolean} isCanceled Pass True to cancel the user's subscription
3179
+ * @param {Object} [options] Additional Telegram query options
3180
+ * @return {Promise} On success, True is returned
3181
+ * @see https://core.telegram.org/bots/api#edituserstarsubscription
3182
+ */
3183
+ editUserStarSubscription(userId, telegramPaymentChargeId, isCanceled, form = {}) {
3184
+ form.user_id = userId;
3185
+ form.telegram_payment_charge_id = telegramPaymentChargeId;
3186
+ form.is_canceled = isCanceled;
3187
+ return this._request('editUserStarSubscription', { form });
3188
+ }
3189
+
3190
+ /**
3191
+ * Use this method to store an inline message that can be sent on behalf of a user.
3192
+ *
3193
+ * @param {Number} userId Unique identifier of the target user
3194
+ * @param {Object} result An object describing the message to be sent
3195
+ * @param {Object} [options] Additional Telegram query options
3196
+ * @return {Promise} On success, returns a PreparedInlineMessage object
3197
+ * @see https://core.telegram.org/bots/api#savepreparedinlinemessage
3198
+ */
3199
+ savePreparedInlineMessage(userId, result, form = {}) {
3200
+ form.user_id = userId;
3201
+ form.result = stringify(result);
3202
+ return this._request('savePreparedInlineMessage', { form });
3203
+ }
3204
+
3205
+ // ==========================================
3206
+ // Bot API 8.2
3207
+ // ==========================================
3208
+
3209
+ /**
3210
+ * Use this method to verify a user that is managed by the bot.
3211
+ *
3212
+ * @param {Number} userId Unique identifier of the target user
3213
+ * @param {Object} [options] Additional Telegram query options
3214
+ * @return {Promise} On success, True is returned
3215
+ * @see https://core.telegram.org/bots/api#verifyuser
3216
+ */
3217
+ verifyUser(userId, form = {}) {
3218
+ form.user_id = userId;
3219
+ return this._request('verifyUser', { form });
3220
+ }
3221
+
3222
+ /**
3223
+ * Use this method to verify a chat that is managed by the bot.
3224
+ *
3225
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3226
+ * @param {Object} [options] Additional Telegram query options
3227
+ * @return {Promise} On success, True is returned
3228
+ * @see https://core.telegram.org/bots/api#verifychat
3229
+ */
3230
+ verifyChat(chatId, form = {}) {
3231
+ form.chat_id = chatId;
3232
+ return this._request('verifyChat', { form });
3233
+ }
3234
+
3235
+ /**
3236
+ * Use this method to remove verification for a user that is managed by the bot.
3237
+ *
3238
+ * @param {Number} userId Unique identifier of the target user
3239
+ * @param {Object} [options] Additional Telegram query options
3240
+ * @return {Promise} On success, True is returned
3241
+ * @see https://core.telegram.org/bots/api#removeuserverification
3242
+ */
3243
+ removeUserVerification(userId, form = {}) {
3244
+ form.user_id = userId;
3245
+ return this._request('removeUserVerification', { form });
3246
+ }
3247
+
3248
+ /**
3249
+ * Use this method to remove verification for a chat that is managed by the bot.
3250
+ *
3251
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3252
+ * @param {Object} [options] Additional Telegram query options
3253
+ * @return {Promise} On success, True is returned
3254
+ * @see https://core.telegram.org/bots/api#removechatverification
3255
+ */
3256
+ removeChatVerification(chatId, form = {}) {
3257
+ form.chat_id = chatId;
3258
+ return this._request('removeChatVerification', { form });
3259
+ }
3260
+
3261
+ // ==========================================
3262
+ // Bot API 9.0: Business Accounts + Gifts
3263
+ // ==========================================
3264
+
3265
+ /**
3266
+ * Use this method to mark incoming messages as read on behalf of a business account.
3267
+ *
3268
+ * @param {String} businessConnectionId Unique identifier of the business connection
3269
+ * @param {Number} messageId Unique identifier of the message to mark as read
3270
+ * @param {Object} [options] Additional Telegram query options
3271
+ * @return {Promise} True on success
3272
+ * @see https://core.telegram.org/bots/api#readbusinessmessage
3273
+ */
3274
+ readBusinessMessage(businessConnectionId, messageId, form = {}) {
3275
+ form.business_connection_id = businessConnectionId;
3276
+ form.message_id = messageId;
3277
+ return this._request('readBusinessMessage', { form });
3278
+ }
3279
+
3280
+ /**
3281
+ * Use this method to delete messages on behalf of a business account.
3282
+ *
3283
+ * @param {String} businessConnectionId Unique identifier of the business connection
3284
+ * @param {Array<Number>} messageIds Unique identifiers of 1-100 messages to delete
3285
+ * @param {Object} [options] Additional Telegram query options
3286
+ * @return {Promise} True on success
3287
+ * @see https://core.telegram.org/bots/api#deletebusinessmessages
3288
+ */
3289
+ deleteBusinessMessages(businessConnectionId, messageIds, form = {}) {
3290
+ form.business_connection_id = businessConnectionId;
3291
+ form.message_ids = stringify(messageIds);
3292
+ return this._request('deleteBusinessMessages', { form });
3293
+ }
3294
+
3295
+ /**
3296
+ * Use this method to change the first and last name of a managed business account.
3297
+ *
3298
+ * @param {String} businessConnectionId Unique identifier of the business connection
3299
+ * @param {Object} [options] Additional Telegram query options
3300
+ * @return {Promise} True on success
3301
+ * @see https://core.telegram.org/bots/api#setbusinessaccountname
3302
+ */
3303
+ setBusinessAccountName(businessConnectionId, form = {}) {
3304
+ form.business_connection_id = businessConnectionId;
3305
+ return this._request('setBusinessAccountName', { form });
3306
+ }
3307
+
3308
+ /**
3309
+ * Use this method to change the username of a managed business account.
3310
+ *
3311
+ * @param {String} businessConnectionId Unique identifier of the business connection
3312
+ * @param {Object} [options] Additional Telegram query options
3313
+ * @return {Promise} True on success
3314
+ * @see https://core.telegram.org/bots/api#setbusinessaccountusername
3315
+ */
3316
+ setBusinessAccountUsername(businessConnectionId, form = {}) {
3317
+ form.business_connection_id = businessConnectionId;
3318
+ return this._request('setBusinessAccountUsername', { form });
3319
+ }
3320
+
3321
+ /**
3322
+ * Use this method to change the bio of a managed business account.
3323
+ *
3324
+ * @param {String} businessConnectionId Unique identifier of the business connection
3325
+ * @param {Object} [options] Additional Telegram query options
3326
+ * @return {Promise} True on success
3327
+ * @see https://core.telegram.org/bots/api#setbusinessaccountbio
3328
+ */
3329
+ setBusinessAccountBio(businessConnectionId, form = {}) {
3330
+ form.business_connection_id = businessConnectionId;
3331
+ return this._request('setBusinessAccountBio', { form });
3332
+ }
3333
+
3334
+ /**
3335
+ * Use this method to change the profile photo of a managed business account.
3336
+ *
3337
+ * @param {String} businessConnectionId Unique identifier of the business connection
3338
+ * @param {Object} photo InputProfilePhoto object
3339
+ * @param {Object} [options] Additional Telegram query options
3340
+ * @return {Promise} True on success
3341
+ * @see https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
3342
+ */
3343
+ setBusinessAccountProfilePhoto(businessConnectionId, photo, form = {}) {
3344
+ form.business_connection_id = businessConnectionId;
3345
+ form.photo = stringify(photo);
3346
+ return this._request('setBusinessAccountProfilePhoto', { form });
3347
+ }
3348
+
3349
+ /**
3350
+ * Use this method to remove the profile photo of a managed business account.
3351
+ *
3352
+ * @param {String} businessConnectionId Unique identifier of the business connection
3353
+ * @param {Object} [options] Additional Telegram query options
3354
+ * @return {Promise} True on success
3355
+ * @see https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
3356
+ */
3357
+ removeBusinessAccountProfilePhoto(businessConnectionId, form = {}) {
3358
+ form.business_connection_id = businessConnectionId;
3359
+ return this._request('removeBusinessAccountProfilePhoto', { form });
3360
+ }
3361
+
3362
+ /**
3363
+ * Use this method to change the gift settings of a managed business account.
3364
+ *
3365
+ * @param {String} businessConnectionId Unique identifier of the business connection
3366
+ * @param {Object} [options] Additional Telegram query options
3367
+ * @return {Promise} True on success
3368
+ * @see https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
3369
+ */
3370
+ setBusinessAccountGiftSettings(businessConnectionId, form = {}) {
3371
+ form.business_connection_id = businessConnectionId;
3372
+ if (form.accepted_gift_types) {
3373
+ form.accepted_gift_types = stringify(form.accepted_gift_types);
3374
+ }
3375
+ return this._request('setBusinessAccountGiftSettings', { form });
3376
+ }
3377
+
3378
+ /**
3379
+ * Use this method to get the current Star balance of a managed business account.
3380
+ *
3381
+ * @param {String} businessConnectionId Unique identifier of the business connection
3382
+ * @param {Object} [options] Additional Telegram query options
3383
+ * @return {Promise} Returns a StarAmount object
3384
+ * @see https://core.telegram.org/bots/api#getbusinessaccountstarbalance
3385
+ */
3386
+ getBusinessAccountStarBalance(businessConnectionId, form = {}) {
3387
+ form.business_connection_id = businessConnectionId;
3388
+ return this._request('getBusinessAccountStarBalance', { form });
3389
+ }
3390
+
3391
+ /**
3392
+ * Use this method to transfer Stars from the business account balance to the bot owner's balance.
3393
+ *
3394
+ * @param {String} businessConnectionId Unique identifier of the business connection
3395
+ * @param {Number} starCount Number of Telegram Stars to transfer, 1-10000
3396
+ * @param {Object} [options] Additional Telegram query options
3397
+ * @return {Promise} Returns a StarAmount object
3398
+ * @see https://core.telegram.org/bots/api#transferbusinessaccountstars
3399
+ */
3400
+ transferBusinessAccountStars(businessConnectionId, starCount, form = {}) {
3401
+ form.business_connection_id = businessConnectionId;
3402
+ form.star_count = starCount;
3403
+ return this._request('transferBusinessAccountStars', { form });
3404
+ }
3405
+
3406
+ /**
3407
+ * Use this method to get the list of gifts received by a managed business account.
3408
+ *
3409
+ * @param {String} businessConnectionId Unique identifier of the business connection
3410
+ * @param {Object} [options] Additional Telegram query options
3411
+ * @return {Promise} Returns an Array of OwnedGift objects
3412
+ * @see https://core.telegram.org/bots/api#getbusinessaccountgifts
3413
+ */
3414
+ getBusinessAccountGifts(businessConnectionId, form = {}) {
3415
+ form.business_connection_id = businessConnectionId;
3416
+ return this._request('getBusinessAccountGifts', { form });
3417
+ }
3418
+
3419
+ /**
3420
+ * Use this method to convert a given regular gift to Telegram Stars.
3421
+ *
3422
+ * @param {String} businessConnectionId Unique identifier of the business connection
3423
+ * @param {String} ownedGiftId Identifier of the regular gift
3424
+ * @param {Object} [options] Additional Telegram query options
3425
+ * @return {Promise} Returns a StarAmount object
3426
+ * @see https://core.telegram.org/bots/api#convertgifttostars
3427
+ */
3428
+ convertGiftToStars(businessConnectionId, ownedGiftId, form = {}) {
3429
+ form.business_connection_id = businessConnectionId;
3430
+ form.owned_gift_id = ownedGiftId;
3431
+ return this._request('convertGiftToStars', { form });
3432
+ }
3433
+
3434
+ /**
3435
+ * Use this method to upgrade a regular gift to a unique or upgrade a unique gift to an upgraded collectible gift.
3436
+ *
3437
+ * @param {String} businessConnectionId Unique identifier of the business connection
3438
+ * @param {String} ownedGiftId Identifier of the regular gift to upgrade
3439
+ * @param {Object} [options] Additional Telegram query options
3440
+ * @return {Promise} Returns the updated OwnedGift object
3441
+ * @see https://core.telegram.org/bots/api#upgradegift
3442
+ */
3443
+ upgradeGift(businessConnectionId, ownedGiftId, form = {}) {
3444
+ form.business_connection_id = businessConnectionId;
3445
+ form.owned_gift_id = ownedGiftId;
3446
+ return this._request('upgradeGift', { form });
3447
+ }
3448
+
3449
+ /**
3450
+ * Use this method to transfer a regular gift to another user.
3451
+ *
3452
+ * @param {String} businessConnectionId Unique identifier of the business connection
3453
+ * @param {String} ownedGiftId Identifier of the gift to transfer
3454
+ * @param {Number|String} newOwnerChatId Unique identifier of the new owner of the gift
3455
+ * @param {Object} [options] Additional Telegram query options
3456
+ * @return {Promise} True on success
3457
+ * @see https://core.telegram.org/bots/api#transfergift
3458
+ */
3459
+ transferGift(businessConnectionId, ownedGiftId, newOwnerChatId, form = {}) {
3460
+ form.business_connection_id = businessConnectionId;
3461
+ form.owned_gift_id = ownedGiftId;
3462
+ form.new_owner_chat_id = newOwnerChatId;
3463
+ return this._request('transferGift', { form });
3464
+ }
3465
+
3466
+ /**
3467
+ * Use this method to post a story on behalf of a managed business account.
3468
+ *
3469
+ * @param {String} businessConnectionId Unique identifier of the business connection
3470
+ * @param {Object} content InputStoryContent object
3471
+ * @param {Object} [options] Additional Telegram query options
3472
+ * @return {Promise} Returns a Story object
3473
+ * @see https://core.telegram.org/bots/api#poststory
3474
+ */
3475
+ postStory(businessConnectionId, content, form = {}) {
3476
+ form.business_connection_id = businessConnectionId;
3477
+ form.content = stringify(content);
3478
+ return this._request('postStory', { form });
3479
+ }
3480
+
3481
+ /**
3482
+ * Use this method to edit a story previously posted on behalf of a managed business account.
3483
+ *
3484
+ * @param {String} businessConnectionId Unique identifier of the business connection
3485
+ * @param {Number} storyId Identifier of the story to edit
3486
+ * @param {Object} [options] Additional Telegram query options
3487
+ * @return {Promise} Returns the edited Story object
3488
+ * @see https://core.telegram.org/bots/api#editstory
3489
+ */
3490
+ editStory(businessConnectionId, storyId, form = {}) {
3491
+ form.business_connection_id = businessConnectionId;
3492
+ form.story_id = storyId;
3493
+ if (form.content) {
3494
+ form.content = stringify(form.content);
3495
+ }
3496
+ return this._request('editStory', { form });
3497
+ }
3498
+
3499
+ /**
3500
+ * Use this method to delete a story previously posted on behalf of a managed business account.
3501
+ *
3502
+ * @param {String} businessConnectionId Unique identifier of the business connection
3503
+ * @param {Number} storyId Identifier of the story to delete
3504
+ * @param {Object} [options] Additional Telegram query options
3505
+ * @return {Promise} True on success
3506
+ * @see https://core.telegram.org/bots/api#deletestory
3507
+ */
3508
+ deleteStory(businessConnectionId, storyId, form = {}) {
3509
+ form.business_connection_id = businessConnectionId;
3510
+ form.story_id = storyId;
3511
+ return this._request('deleteStory', { form });
3512
+ }
3513
+
3514
+ /**
3515
+ * Use this method to gift a Telegram Premium subscription to a user.
3516
+ *
3517
+ * @param {Number|String} userId Unique identifier of the target user
3518
+ * @param {Number} monthCount Number of months the subscription will be active for, 1-36
3519
+ * @param {Number} starCount Number of Telegram Stars that will be paid for the subscription, 1-10000
3520
+ * @param {Object} [options] Additional Telegram query options
3521
+ * @return {Promise} Returns the Gift object that was paid for
3522
+ * @see https://core.telegram.org/bots/api#giftpremiumsubscription
3523
+ */
3524
+ giftPremiumSubscription(userId, monthCount, starCount, form = {}) {
3525
+ form.user_id = userId;
3526
+ form.month_count = monthCount;
3527
+ form.star_count = starCount;
3528
+ return this._request('giftPremiumSubscription', { form });
3529
+ }
3530
+
3531
+ /**
3532
+ * Use this method to set the emoji status of a user.
3533
+ *
3534
+ * @param {Number|String} userId Unique identifier of the target user
3535
+ * @param {Object} [options] Additional Telegram query options
3536
+ * @return {Promise} True on success
3537
+ * @see https://core.telegram.org/bots/api#setuseremojistatus
3538
+ */
3539
+ setUserEmojiStatus(userId, form = {}) {
3540
+ form.user_id = userId;
3541
+ return this._request('setUserEmojiStatus', { form });
3542
+ }
3543
+
3544
+ // ==========================================
3545
+ // Bot API 9.1: Checklists
3546
+ // ==========================================
3547
+
3548
+ /**
3549
+ * Use this method to send a checklist on behalf of a managed business account.
3550
+ *
3551
+ * @param {String} businessConnectionId Unique identifier of the business connection
3552
+ * @param {String} title Title of the checklist, 1-255 characters after entities parsing
3553
+ * @param {Array} tasks List of 1-100 tasks in the checklist
3554
+ * @param {Object} [options] Additional Telegram query options
3555
+ * @return {Promise} On success, the sent Message is returned
3556
+ * @see https://core.telegram.org/bots/api#sendchecklist
3557
+ */
3558
+ sendChecklist(businessConnectionId, title, tasks, form = {}) {
3559
+ form.business_connection_id = businessConnectionId;
3560
+ form.title = title;
3561
+ form.tasks = stringify(tasks);
3562
+ return this._request('sendChecklist', { form });
3563
+ }
3564
+
3565
+ /**
3566
+ * Use this method to edit a checklist message on behalf of a managed business account.
3567
+ *
3568
+ * @param {String} businessConnectionId Unique identifier of the business connection
3569
+ * @param {Number} messageId Unique identifier of the message to edit
3570
+ * @param {Object} [options] Additional Telegram query options
3571
+ * @return {Promise} On success, the edited Message is returned
3572
+ * @see https://core.telegram.org/bots/api#editmessagechecklist
3573
+ */
3574
+ editMessageChecklist(businessConnectionId, messageId, form = {}) {
3575
+ form.business_connection_id = businessConnectionId;
3576
+ form.message_id = messageId;
3577
+ if (form.tasks) {
3578
+ form.tasks = stringify(form.tasks);
3579
+ }
3580
+ return this._request('editMessageChecklist', { form });
3581
+ }
3582
+
3583
+ /**
3584
+ * Use this method to get the current number of Telegram Stars owned by the bot.
3585
+ *
3586
+ * @param {Object} [options] Additional Telegram query options
3587
+ * @return {Promise} Returns a StarAmount object
3588
+ * @see https://core.telegram.org/bots/api#getmystarbalance
3589
+ */
3590
+ getMyStarBalance(form = {}) {
3591
+ return this._request('getMyStarBalance', { form });
3592
+ }
3593
+
3594
+ // ==========================================
3595
+ // Bot API 9.2: Suggested Posts
3596
+ // ==========================================
3597
+
3598
+ /**
3599
+ * Use this method to approve a suggested post in a channel chat.
3600
+ *
3601
+ * @param {String} businessConnectionId Unique identifier of the business connection
3602
+ * @param {Number} messageId Unique identifier of the suggested post message
3603
+ * @param {Object} [options] Additional Telegram query options
3604
+ * @return {Promise} True on success
3605
+ * @see https://core.telegram.org/bots/api#approvesuggestedpost
3606
+ */
3607
+ approveSuggestedPost(businessConnectionId, messageId, form = {}) {
3608
+ form.business_connection_id = businessConnectionId;
3609
+ form.message_id = messageId;
3610
+ return this._request('approveSuggestedPost', { form });
3611
+ }
3612
+
3613
+ /**
3614
+ * Use this method to decline a suggested post in a channel chat.
3615
+ *
3616
+ * @param {String} businessConnectionId Unique identifier of the business connection
3617
+ * @param {Number} messageId Unique identifier of the suggested post message
3618
+ * @param {Object} [options] Additional Telegram query options
3619
+ * @return {Promise} True on success
3620
+ * @see https://core.telegram.org/bots/api#declinesuggestedpost
3621
+ */
3622
+ declineSuggestedPost(businessConnectionId, messageId, form = {}) {
3623
+ form.business_connection_id = businessConnectionId;
3624
+ form.message_id = messageId;
3625
+ return this._request('declineSuggestedPost', { form });
3626
+ }
3627
+
3628
+ // ==========================================
3629
+ // Bot API 9.3: Draft Messages, Gifts, Stories
3630
+ // ==========================================
3631
+
3632
+ /**
3633
+ * Use this method to send a draft message to the bot's user in private chat.
3634
+ *
3635
+ * @param {Number|String} chatId Unique identifier of the target private chat
3636
+ * @param {String} text Text of the message, 1-4096 characters after entities parsing
3637
+ * @param {Object} [options] Additional Telegram query options
3638
+ * @return {Promise} On success, the sent Message is returned
3639
+ * @see https://core.telegram.org/bots/api#sendmessagedraft
3640
+ */
3641
+ sendMessageDraft(chatId, text, form = {}) {
3642
+ form.chat_id = chatId;
3643
+ form.text = text;
3644
+ if (form.entities) {
3645
+ form.entities = stringify(form.entities);
3646
+ }
3647
+ if (form.link_preview_options) {
3648
+ form.link_preview_options = stringify(form.link_preview_options);
3649
+ }
3650
+ return this._request('sendMessageDraft', { form });
3651
+ }
3652
+
3653
+ /**
3654
+ * Use this method to get gifts received by a user in a private chat.
3655
+ *
3656
+ * @param {Number|String} userId Unique identifier of the target user
3657
+ * @param {Object} [options] Additional Telegram query options
3658
+ * @return {Promise} Array of OwnedGift objects
3659
+ * @see https://core.telegram.org/bots/api#getusergifts
3660
+ */
3661
+ getUserGifts(userId, form = {}) {
3662
+ form.user_id = userId;
3663
+ return this._request('getUserGifts', { form });
3664
+ }
3665
+
3666
+ /**
3667
+ * Use this method to get gifts received by a chat.
3668
+ *
3669
+ * @param {Number|String} chatId Unique identifier of the target chat
3670
+ * @param {Object} [options] Additional Telegram query options
3671
+ * @return {Promise} Array of OwnedGift objects
3672
+ * @see https://core.telegram.org/bots/api#getchatgifts
3673
+ */
3674
+ getChatGifts(chatId, form = {}) {
3675
+ form.chat_id = chatId;
3676
+ return this._request('getChatGifts', { form });
3677
+ }
3678
+
3679
+ /**
3680
+ * Use this method to repost a story on behalf of a managed business account.
3681
+ *
3682
+ * @param {String} businessConnectionId Unique identifier of the business connection
3683
+ * @param {Number} storyId Identifier of the story to repost
3684
+ * @param {Array<Number|String>} targetBusinessConnectionIds Identifiers of the business connections to post the story to
3685
+ * @param {Object} [options] Additional Telegram query options
3686
+ * @return {Promise} Array of Story objects
3687
+ * @see https://core.telegram.org/bots/api#repoststory
3688
+ */
3689
+ repostStory(businessConnectionId, storyId, targetBusinessConnectionIds, form = {}) {
3690
+ form.business_connection_id = businessConnectionId;
3691
+ form.story_id = storyId;
3692
+ form.target_business_connection_ids = stringify(targetBusinessConnectionIds);
3693
+ return this._request('repostStory', { form });
3694
+ }
3695
+
3696
+ // ==========================================
3697
+ // Bot API 9.4: Profile Photos, Audio Stories
3698
+ // ==========================================
3699
+
3700
+ /**
3701
+ * Use this method to set the profile photo of the bot.
3702
+ *
3703
+ * @param {Object} photo InputProfilePhoto object
3704
+ * @param {Object} [options] Additional Telegram query options
3705
+ * @return {Promise} True on success
3706
+ * @see https://core.telegram.org/bots/api#setmyprofilephoto
3707
+ */
3708
+ setMyProfilePhoto(photo, form = {}) {
3709
+ form.photo = stringify(photo);
3710
+ return this._request('setMyProfilePhoto', { form });
3711
+ }
3712
+
3713
+ /**
3714
+ * Use this method to remove the profile photo of the bot.
3715
+ *
3716
+ * @param {Object} [options] Additional Telegram query options
3717
+ * @return {Promise} True on success
3718
+ * @see https://core.telegram.org/bots/api#removemyprofilephoto
3719
+ */
3720
+ removeMyProfilePhoto(form = {}) {
3721
+ return this._request('removeMyProfilePhoto', { form });
3722
+ }
3723
+
3724
+ /**
3725
+ * Use this method to get the profile audios of a user.
3726
+ *
3727
+ * @param {Number|String} userId Unique identifier of the target user
3728
+ * @param {Object} [options] Additional Telegram query options
3729
+ * @return {Promise} Array of Audio objects
3730
+ * @see https://core.telegram.org/bots/api#getuserprofileaudios
3731
+ */
3732
+ getUserProfileAudios(userId, form = {}) {
3733
+ form.user_id = userId;
3734
+ return this._request('getUserProfileAudios', { form });
3735
+ }
3736
+
3737
+ // ==========================================
3738
+ // Bot API 9.5: Chat Member Tags
3739
+ // ==========================================
3740
+
3741
+ /**
3742
+ * Use this method to set the tag that is applied to a specific user in a specific group chat.
3743
+ *
3744
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target group
3745
+ * @param {Number|String} userId Unique identifier of the target user
3746
+ * @param {Object} [options] Additional Telegram query options
3747
+ * @return {Promise} True on success
3748
+ * @see https://core.telegram.org/bots/api#setchatmembertag
3749
+ */
3750
+ setChatMemberTag(chatId, userId, form = {}) {
3751
+ form.chat_id = chatId;
3752
+ form.user_id = userId;
3753
+ return this._request('setChatMemberTag', { form });
3754
+ }
3755
+
3756
+ // ==========================================
3757
+ // Bot API 9.6: Managed Bot Tokens
3758
+ // ==========================================
3759
+
3760
+ /**
3761
+ * Use this method to get the current managable bot token for the bot.
3762
+ *
3763
+ * @param {Number} botId Identifier of the bot to get the token for
3764
+ * @param {Object} [options] Additional Telegram query options
3765
+ * @return {Promise} Returns a ManagedBotToken object
3766
+ * @see https://core.telegram.org/bots/api#getmanagedbottoken
3767
+ */
3768
+ getManagedBotToken(botId, form = {}) {
3769
+ form.bot_id = botId;
3770
+ return this._request('getManagedBotToken', { form });
3771
+ }
3772
+
3773
+ /**
3774
+ * Use this method to replace the managable bot token for the bot with a new one.
3775
+ *
3776
+ * @param {Number} botId Identifier of the bot whose token will be replaced
3777
+ * @param {Object} [options] Additional Telegram query options
3778
+ * @return {Promise} Returns a ManagedBotToken object
3779
+ * @see https://core.telegram.org/bots/api#replacemanagedbottoken
3780
+ */
3781
+ replaceManagedBotToken(botId, form = {}) {
3782
+ form.bot_id = botId;
3783
+ return this._request('replaceManagedBotToken', { form });
3784
+ }
3785
+
3786
+ /**
3787
+ * Use this method to save a prepared keyboard button for later use.
3788
+ *
3789
+ * @param {Object} button KeyboardButton object to save
3790
+ * @param {Object} [options] Additional Telegram query options
3791
+ * @return {Promise} Returns a PreparedKeyboardButton object
3792
+ * @see https://core.telegram.org/bots/api#savepreparedkeyboardbutton
3793
+ */
3794
+ savePreparedKeyboardButton(button, form = {}) {
3795
+ form.button = stringify(button);
3796
+ return this._request('savePreparedKeyboardButton', { form });
3797
+ }
3798
+
3799
+ // ==========================================
3800
+ // Bot API 10.0: Guest Mode, Live Photos, Reactions
3801
+ // ==========================================
3802
+
3803
+ /**
3804
+ * Use this method to answer a guest query in a Telegram Web App.
3805
+ *
3806
+ * @param {String} guestQueryId Unique identifier for the query to be answered
3807
+ * @param {String} text Text of the message
3808
+ * @param {Object} [options] Additional Telegram query options
3809
+ * @return {Promise} True on success
3810
+ * @see https://core.telegram.org/bots/api#answerguestquery
3811
+ */
3812
+ answerGuestQuery(guestQueryId, text, form = {}) {
3813
+ form.guest_query_id = guestQueryId;
3814
+ form.text = text;
3815
+ return this._request('answerGuestQuery', { form });
3816
+ }
3817
+
3818
+ /**
3819
+ * Use this method to remove multiple reactions from a message.
3820
+ *
3821
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3822
+ * @param {Number} messageId Unique identifier of the target message
3823
+ * @param {Object} [options] Additional Telegram query options
3824
+ * @return {Promise} True on success
3825
+ * @see https://core.telegram.org/bots/api#deletemessagereactions
3826
+ */
3827
+ deleteAllMessageReactions(chatId, messageId, form = {}) {
3828
+ form.chat_id = chatId;
3829
+ form.message_id = messageId;
3830
+ return this._request('deleteAllMessageReactions', { form });
3831
+ }
3832
+
3833
+ /**
3834
+ * Use this method to remove a reaction from a message.
3835
+ *
3836
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3837
+ * @param {Number} messageId Unique identifier of the target message
3838
+ * @param {Object} [options] Additional Telegram query options
3839
+ * @return {Promise} True on success
3840
+ * @see https://core.telegram.org/bots/api#deletemessagereaction
3841
+ */
3842
+ deleteMessageReaction(chatId, messageId, form = {}) {
3843
+ form.chat_id = chatId;
3844
+ form.message_id = messageId;
3845
+ if (form.reaction_type) {
3846
+ form.reaction_type = stringify(form.reaction_type);
3847
+ }
3848
+ return this._request('deleteMessageReaction', { form });
3849
+ }
3850
+
3851
+ /**
3852
+ * Use this method to send a live photo.
3853
+ *
3854
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3855
+ * @param {String|stream.Stream|Buffer} photo A file path, Stream, Buffer, or file_id
3856
+ * @param {String|stream.Stream|Buffer} video A file path, Stream, Buffer, or file_id
3857
+ * @param {Object} [options] Additional Telegram query options
3858
+ * @param {Object} [fileOptions] Optional file related meta-data
3859
+ * @return {Promise} On success, the sent Message object is returned
3860
+ * @see https://core.telegram.org/bots/api#sendlivephoto
3861
+ */
3862
+ sendLivePhoto(chatId, photo, video, form = {}, fileOptions = {}) {
3863
+ const opts = {
3864
+ qs: form
3865
+ };
3866
+ opts.qs.chat_id = chatId;
3867
+ try {
3868
+ const sendDataPhoto = this._formatSendData('photo', photo, fileOptions);
3869
+ const sendDataVideo = this._formatSendData('video', video, fileOptions);
3870
+ opts.formData = Object.assign({}, sendDataPhoto[0], sendDataVideo[0]);
3871
+ opts.qs.photo = sendDataPhoto[1];
3872
+ opts.qs.video = sendDataVideo[1];
3873
+ } catch (ex) {
3874
+ return Promise.reject(ex);
3875
+ }
3876
+ return this._request('sendLivePhoto', opts);
3877
+ }
3878
+
3879
+ /**
3880
+ * Use this method to get the current access settings of the bot for managed bots.
3881
+ *
3882
+ * @param {Object} [options] Additional Telegram query options
3883
+ * @return {Promise} Returns a ManagedBotAccessSettings object
3884
+ * @see https://core.telegram.org/bots/api#getmanagedbotaccesssettings
3885
+ */
3886
+ getManagedBotAccessSettings(form = {}) {
3887
+ return this._request('getManagedBotAccessSettings', { form });
3888
+ }
3889
+
3890
+ /**
3891
+ * Use this method to change the access settings of the bot for managed bots.
3892
+ *
3893
+ * @param {Object} [options] Additional Telegram query options
3894
+ * @return {Promise} True on success
3895
+ * @see https://core.telegram.org/bots/api#setmanagedbotaccesssettings
3896
+ */
3897
+ setManagedBotAccessSettings(form = {}) {
3898
+ if (form.restricted_channels) {
3899
+ form.restricted_channels = stringify(form.restricted_channels);
3900
+ }
3901
+ return this._request('setManagedBotAccessSettings', { form });
3902
+ }
3903
+
3904
+ /**
3905
+ * Use this method to get messages from a user's personal chat with the bot.
3906
+ *
3907
+ * @param {Number} userId Unique identifier of the target user
3908
+ * @param {Object} [options] Additional Telegram query options
3909
+ * @return {Promise} Array of Message objects
3910
+ * @see https://core.telegram.org/bots/api#getuserpersonalchatmessages
3911
+ */
3912
+ getUserPersonalChatMessages(userId, form = {}) {
3913
+ form.user_id = userId;
3914
+ return this._request('getUserPersonalChatMessages', { form });
3915
+ }
3916
+
3917
+ // ==========================================
3918
+ // Bot API 10.1: Rich Messages, Join Request Queries
3919
+ // ==========================================
3920
+
3921
+ /**
3922
+ * Use this method to send a rich message.
3923
+ *
3924
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3925
+ * @param {Object} content An InputRichMessageContent object
3926
+ * @param {Object} [options] Additional Telegram query options
3927
+ * @return {Promise} On success, the sent Message object is returned
3928
+ * @see https://core.telegram.org/bots/api#sendrichmessage
3929
+ */
3930
+ sendRichMessage(chatId, content, form = {}) {
3931
+ form.chat_id = chatId;
3932
+ form.content = stringify(content);
3933
+ return this._request('sendRichMessage', { form });
3934
+ }
3935
+
3936
+ /**
3937
+ * Use this method to send a rich message draft.
3938
+ *
3939
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3940
+ * @param {Object} content An InputRichMessageContent object
3941
+ * @param {Object} [options] Additional Telegram query options
3942
+ * @return {Promise} On success, a Message object is returned
3943
+ * @see https://core.telegram.org/bots/api#sendrichmessagedraft
3944
+ */
3945
+ sendRichMessageDraft(chatId, content, form = {}) {
3946
+ form.chat_id = chatId;
3947
+ form.content = stringify(content);
3948
+ return this._request('sendRichMessageDraft', { form });
3949
+ }
3950
+
3951
+ /**
3952
+ * Use this method to answer a chat join request query.
3953
+ *
3954
+ * @param {Number} chatJoinRequestId Unique identifier of the chat join request
3955
+ * @param {String} queryId Unique identifier for the query to be answered
3956
+ * @param {Object} [options] Additional Telegram query options
3957
+ * @return {Promise} True on success
3958
+ * @see https://core.telegram.org/bots/api#answerchatjoinrequestquery
3959
+ */
3960
+ answerChatJoinRequestQuery(chatJoinRequestId, queryId, form = {}) {
3961
+ form.chat_join_request_id = chatJoinRequestId;
3962
+ form.query_id = queryId;
3963
+ return this._request('answerChatJoinRequestQuery', { form });
3964
+ }
3965
+
3966
+ /**
3967
+ * Use this method to send a Web App message to a chat join request.
3968
+ *
3969
+ * @param {Number} chatJoinRequestId Unique identifier of the chat join request
3970
+ * @param {Object} webApp A SentWebAppMessage object
3971
+ * @param {Object} [options] Additional Telegram query options
3972
+ * @return {Promise} True on success
3973
+ * @see https://core.telegram.org/bots/api#sendchatjoinrequestwebapp
3974
+ */
3975
+ sendChatJoinRequestWebApp(chatJoinRequestId, webApp, form = {}) {
3976
+ form.chat_join_request_id = chatJoinRequestId;
3977
+ form.web_app = stringify(webApp);
3978
+ return this._request('sendChatJoinRequestWebApp', { form });
3979
+ }
3980
+
3981
+ // ==========================================
3982
+ // Bot API 10.2: Ephemeral Messages
3983
+ // ==========================================
3984
+
3985
+ /**
3986
+ * Use this method to edit the text of an ephemeral message.
3987
+ *
3988
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
3989
+ * @param {String} ephemeralMessageId Unique identifier of the ephemeral message
3990
+ * @param {String} text New text of the message
3991
+ * @param {Object} [options] Additional Telegram query options
3992
+ * @return {Promise} On success, the edited Message object is returned
3993
+ * @see https://core.telegram.org/bots/api#editephemeralmessagetext
3994
+ */
3995
+ editEphemeralMessageText(chatId, ephemeralMessageId, text, form = {}) {
3996
+ form.chat_id = chatId;
3997
+ form.ephemeral_message_id = ephemeralMessageId;
3998
+ form.text = text;
3999
+ return this._request('editEphemeralMessageText', { form });
4000
+ }
4001
+
4002
+ /**
4003
+ * Use this method to edit the media of an ephemeral message.
4004
+ *
4005
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
4006
+ * @param {String} ephemeralMessageId Unique identifier of the ephemeral message
4007
+ * @param {Object} media An InputMedia object
4008
+ * @param {Object} [options] Additional Telegram query options
4009
+ * @param {Object} [fileOptions] Optional file related meta-data
4010
+ * @return {Promise} On success, the edited Message object is returned
4011
+ * @see https://core.telegram.org/bots/api#editephemeralmessagemedia
4012
+ */
4013
+ editEphemeralMessageMedia(chatId, ephemeralMessageId, media, form = {}, fileOptions = {}) {
4014
+ form.chat_id = chatId;
4015
+ form.ephemeral_message_id = ephemeralMessageId;
4016
+ form.media = stringify(media);
4017
+ return this._request('editEphemeralMessageMedia', { form });
4018
+ }
4019
+
4020
+ /**
4021
+ * Use this method to edit the caption of an ephemeral message.
4022
+ *
4023
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
4024
+ * @param {String} ephemeralMessageId Unique identifier of the ephemeral message
4025
+ * @param {Object} [options] Additional Telegram query options
4026
+ * @return {Promise} On success, the edited Message object is returned
4027
+ * @see https://core.telegram.org/bots/api#editephemeralmessagecaption
4028
+ */
4029
+ editEphemeralMessageCaption(chatId, ephemeralMessageId, form = {}) {
4030
+ form.chat_id = chatId;
4031
+ form.ephemeral_message_id = ephemeralMessageId;
4032
+ this._fixEntitiesField(form);
4033
+ return this._request('editEphemeralMessageCaption', { form });
4034
+ }
4035
+
4036
+ /**
4037
+ * Use this method to edit the reply markup of an ephemeral message.
4038
+ *
4039
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
4040
+ * @param {String} ephemeralMessageId Unique identifier of the ephemeral message
4041
+ * @param {Object} [options] Additional Telegram query options
4042
+ * @return {Promise} On success, the edited Message object is returned
4043
+ * @see https://core.telegram.org/bots/api#editephemeralmessagereplymarkup
4044
+ */
4045
+ editEphemeralMessageReplyMarkup(chatId, ephemeralMessageId, form = {}) {
4046
+ form.chat_id = chatId;
4047
+ form.ephemeral_message_id = ephemeralMessageId;
4048
+ return this._request('editEphemeralMessageReplyMarkup', { form });
4049
+ }
4050
+
4051
+ /**
4052
+ * Use this method to delete an ephemeral message.
4053
+ *
4054
+ * @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
4055
+ * @param {String} ephemeralMessageId Unique identifier of the ephemeral message
4056
+ * @param {Object} [options] Additional Telegram query options
4057
+ * @return {Promise} True on success
4058
+ * @see https://core.telegram.org/bots/api#deleteephemeralmessage
4059
+ */
4060
+ deleteEphemeralMessage(chatId, ephemeralMessageId, form = {}) {
4061
+ form.chat_id = chatId;
4062
+ form.ephemeral_message_id = ephemeralMessageId;
4063
+ return this._request('deleteEphemeralMessage', { form });
4064
+ }
4065
+
3055
4066
  }
3056
4067
 
3057
4068
  module.exports = TelegramBot;