@@ -3363,6 +3363,7 @@ class TelegramBot extends EventEmitter {
3363
3363
* This method verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
3364
3364
*
3365
3365
* @param {Number } userId Unique identifier of the target user
3366
+ * @param {Object } [options] Additional Telegram query options
3366
3367
* @return {Promise } On success, returns true.
3367
3368
* @see https://core.telegram.org/bots/api#verifyuser
3368
3369
*/
@@ -3376,6 +3377,7 @@ class TelegramBot extends EventEmitter {
3376
3377
*
3377
3378
* @param {Number } chatId Unique identifier of the target chat
3378
3379
* @return {Promise } On success, returns true.
3380
+ * @param {Object } [options] Additional Telegram query options
3379
3381
* @see https://core.telegram.org/bots/api#verifychat
3380
3382
*/
3381
3383
verifyChat ( chatId , form = { } ) {
@@ -3387,6 +3389,7 @@ class TelegramBot extends EventEmitter {
3387
3389
* This method removes verification from a user who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
3388
3390
*
3389
3391
* @param {Number } userId Unique identifier of the target user
3392
+ * @param {Object } [options] Additional Telegram query options
3390
3393
* @return {Promise } On success, returns true.
3391
3394
* @see https://core.telegram.org/bots/api#removeuserverification
3392
3395
*/
@@ -3399,6 +3402,7 @@ class TelegramBot extends EventEmitter {
3399
3402
* This method removes verification from a chat who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
3400
3403
*
3401
3404
* @param {Number } chatId Unique identifier of the target chat
3405
+ * @param {Object } [options] Additional Telegram query options
3402
3406
* @return {Promise } On success, returns true.
3403
3407
* @see https://core.telegram.org/bots/api#removechatverification
3404
3408
*/
@@ -3407,6 +3411,254 @@ class TelegramBot extends EventEmitter {
3407
3411
return this . _request ( 'removeChatVerification' , { form } ) ;
3408
3412
}
3409
3413
3414
+ /**
3415
+ * This method marks incoming message as read on behalf of a business account.
3416
+ *
3417
+ * Requires the **can_read_messages** business bot right
3418
+ *
3419
+ * @param {String } businessConnectionId Unique identifier of the business connection on behalf of which to read the message.
3420
+ * @param {Number } chatId Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.
3421
+ * @param {Number } messageId Unique identifier of the message to mark as read.
3422
+ * @param {Object } [options] Additional Telegram query options
3423
+ * @return {Promise } On success, returns true.
3424
+ * @see https://core.telegram.org/bots/api#readbusinessmessage
3425
+ */
3426
+ readBusinessMessage ( businessConnectionId , chatId , messageId , form = { } ) {
3427
+ form . business_connection_id = businessConnectionId ;
3428
+ form . chat_id = chatId ;
3429
+ form . message_id = messageId ;
3430
+ return this . _request ( 'readBusinessMessage' , { form } ) ;
3431
+ }
3432
+
3433
+ /**
3434
+ * This method delete messages on behalf of a business account.
3435
+ *
3436
+ * Requires the **can_delete_outgoing_messages** business bot right to delete messages sent by the bot itself, or the **can_delete_all_messages business** bot right to delete any message.
3437
+ *
3438
+ * @param {String } businessConnectionId Unique identifier of the business connection on behalf of which to delete the message.
3439
+ * @param {Number[] } messageIds List of 1-100 identifiers of messages to delete. All messages **must be from the same chat**.
3440
+ * @param {Object } [options] Additional Telegram query options
3441
+ * @return {Promise } On success, returns true.
3442
+ * @see https://core.telegram.org/bots/api#deletebusinessmessages
3443
+ */
3444
+ deleteBusinessMessages ( businessConnectionId , messageIds , form = { } ) {
3445
+ form . business_connection_id = businessConnectionId ;
3446
+ form . message_ids = stringify ( messageIds ) ;
3447
+ return this . _request ( 'deleteBusinessMessages' , { form } ) ;
3448
+ }
3449
+
3450
+ /**
3451
+ * This method changes the first and last name of a managed business account.
3452
+ *
3453
+ * Requires the **can_change_name** business bot right.
3454
+ *
3455
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3456
+ * @param {String } firstName The new value of the first name for the business account; 1-64 characters.
3457
+ * @param {Object } [options] Additional Telegram query options
3458
+ * @return {Promise } On success, returns true.
3459
+ * @see https://core.telegram.org/bots/api#setbusinessaccountname
3460
+ */
3461
+ setBusinessAccountName ( businessConnectionId , firstName , form = { } ) {
3462
+ form . business_connection_id = businessConnectionId ;
3463
+ form . first_name = firstName ;
3464
+ return this . _request ( 'setBusinessAccountName' , { form } ) ;
3465
+ }
3466
+
3467
+ /**
3468
+ * This method changes the username of a managed business account.
3469
+ *
3470
+ * Requires the **can_change_username** business bot right.
3471
+ *
3472
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3473
+ * @param {Object } [options] Additional Telegram query options
3474
+ * @return {Promise } On success, returns true.
3475
+ * @see https://core.telegram.org/bots/api#setbusinessaccountusername
3476
+ */
3477
+ setBusinessAccountUsername ( businessConnectionId , form = { } ) {
3478
+ form . business_connection_id = businessConnectionId ;
3479
+ return this . _request ( 'setBusinessAccountUsername' , { form } ) ;
3480
+ }
3481
+
3482
+ /**
3483
+ * This method changes the bio of a managed business account.
3484
+ *
3485
+ * Requires the **can_change_bio** business bot right.
3486
+ *
3487
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3488
+ * @param {Object } [options] Additional Telegram query options
3489
+ * @return {Promise } On success, returns true.
3490
+ * @see https://core.telegram.org/bots/api#setbusinessaccountbio
3491
+ */
3492
+ setBusinessAccountBio ( businessConnectionId , form = { } ) {
3493
+ form . business_connection_id = businessConnectionId ;
3494
+ return this . _request ( 'setBusinessAccountBio' , { form } ) ;
3495
+ }
3496
+
3497
+ /**
3498
+ * This method changes the profile photo of a managed business account.
3499
+ *
3500
+ * Requires the **can_edit_profile_photo** business bot right.
3501
+ *
3502
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3503
+ * @param {String|stream.Stream|Buffer } photo New profile photo.
3504
+ * @param {Object } [options] Additional Telegram query options
3505
+ * @return {Promise } On success, returns true.
3506
+ * @see https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
3507
+ */
3508
+ setBusinessAccountProfilePhoto ( businessConnectionId , photo , form = { } ) {
3509
+ const opts = {
3510
+ qs : { } ,
3511
+ } ;
3512
+
3513
+ opts . qs . business_connection_id = businessConnectionId ;
3514
+
3515
+ try {
3516
+ const sendData = this . _formatSendData ( 'photo' , photo ) ;
3517
+ opts . formData = sendData [ 0 ] ;
3518
+ opts . qs . photo = sendData [ 1 ] ;
3519
+ } catch ( ex ) {
3520
+ return Promise . reject ( ex ) ;
3521
+ }
3522
+
3523
+ return this . _request ( 'setBusinessAccountProfilePhoto' , { form } ) ;
3524
+ }
3525
+
3526
+ /**
3527
+ * This method removes the current profile photo of a managed business account.
3528
+ *
3529
+ * Requires the **can_edit_profile_photo** business bot right.
3530
+ *
3531
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3532
+ * @param {Object } [options] Additional Telegram query options
3533
+ * @return {Promise } On success, returns true.
3534
+ * @see https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
3535
+ */
3536
+ removeBusinessAccountProfilePhoto ( businessConnectionId , form = { } ) {
3537
+ form . business_connection_id = businessConnectionId ;
3538
+ return this . _request ( 'removeBusinessAccountProfilePhoto' , { form } ) ;
3539
+ }
3540
+
3541
+ /**
3542
+ * This method changes the privacy settings pertaining to incoming gifts in a managed business account.
3543
+ *
3544
+ * Requires the **can_change_gift_settings** business bot right.
3545
+ *
3546
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3547
+ * @param {Boolean } showGiftButton Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field.
3548
+ * @param {Object } acceptedGiftTypes Types of gifts accepted by the business account.
3549
+ * @param {Object } [options] Additional Telegram query options
3550
+ * @return {Promise } On success, returns true.
3551
+ * @see https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
3552
+ */
3553
+ setBusinessAccountGiftSettings ( businessConnectionId , showGiftButton , acceptedGiftTypes , form = { } ) {
3554
+ form . business_connection_id = businessConnectionId ;
3555
+ form . show_gift_button = showGiftButton ;
3556
+ form . accepted_gift_types = acceptedGiftTypes ;
3557
+ return this . _request ( 'setBusinessAccountGiftSettings' , { form } ) ;
3558
+ }
3559
+
3560
+ /**
3561
+ * This method returns the amount of Telegram Stars owned by a managed business account.
3562
+ *
3563
+ * Requires the **can_view_gifts_and_stars** business bot right.
3564
+ *
3565
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3566
+ * @param {Object } [options] Additional Telegram query options
3567
+ * @return {Promise } On success, returns [StarAmount](https://core.telegram.org/bots/api#staramount).
3568
+ * @see https://core.telegram.org/bots/api#getbusinessaccountstarbalance
3569
+ */
3570
+ getBusinessAccountStarBalance ( businessConnectionId , form = { } ) {
3571
+ form . business_connection_id = businessConnectionId ;
3572
+ return this . _request ( 'getBusinessAccountStarBalance' , { form } ) ;
3573
+ }
3574
+
3575
+ /**
3576
+ * This method transfers Telegram Stars from the business account balance to the bot's balance.
3577
+ *
3578
+ * Requires the **can_transfer_stars** business bot right.
3579
+ *
3580
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3581
+ * @param {Number } starCount Number of Telegram Stars to transfer; 1-10000.
3582
+ * @param {Object } [options] Additional Telegram query options.
3583
+ * @return {Promise } On success, returns True.
3584
+ * @see https://core.telegram.org/bots/api#transferbusinessaccountstars
3585
+ */
3586
+ transferBusinessAccountStars ( businessConnectionId , startCount , form = { } ) {
3587
+ form . business_connection_id = businessConnectionId ;
3588
+ form . star_count = startCount ;
3589
+ return this . _request ( 'transferBusinessAccountStars' , { form } ) ;
3590
+ }
3591
+
3592
+ /**
3593
+ * This method returns the gifts received and owned by a managed business account.
3594
+ *
3595
+ * Requires the **can_view_gifts_and_stars** business bot right.
3596
+ *
3597
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3598
+ * @param {Object } [options] Additional Telegram query options
3599
+ * @return {Promise } On success, returns [OwnedGifts](https://core.telegram.org/bots/api#ownedgifts).
3600
+ * @see https://core.telegram.org/bots/api#getbusinessaccountgifts
3601
+ */
3602
+ getBusinessAccountGifts ( businessConnectionId , form = { } ) {
3603
+ form . business_connection_id = businessConnectionId ;
3604
+ return this . _request ( 'getBusinessAccountGifts' , { form } ) ;
3605
+ }
3606
+
3607
+ /**
3608
+ * This method converts a given regular gift to Telegram Stars.
3609
+ *
3610
+ * Requires the **can_convert_gifts_to_stars** business bot right.
3611
+ *
3612
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3613
+ * @param {String } ownedGiftId Unique identifier of the regular gift that should be converted to Telegram Stars.
3614
+ * @param {Object } [options] Additional Telegram query options
3615
+ * @return {Promise } On success, returns True.
3616
+ * @see https://core.telegram.org/bots/api#convertgifttostars
3617
+ */
3618
+ convertGiftToStars ( businessConnectionId , ownedGiftId , form = { } ) {
3619
+ form . business_connection_id = businessConnectionId ;
3620
+ form . owned_gift_id = ownedGiftId ;
3621
+ return this . _request ( 'convertGiftToStars' , { form } ) ;
3622
+ }
3623
+
3624
+ /**
3625
+ * This method upgrades a given regular gift to a unique gift.
3626
+ *
3627
+ * Requires the **can_transfer_and_upgrade_gifts** business bot right.
3628
+ * Additionally requires the **can_transfer_stars** business bot right **if the upgrade is paid**.
3629
+ *
3630
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3631
+ * @param {String } ownedGiftId Unique identifier of the regular gift that should be upgraded to a unique one.
3632
+ * @param {Object } [options] Additional Telegram query options
3633
+ * @return {Promise } On success, returns True.
3634
+ * @see https://core.telegram.org/bots/api#upgradegift
3635
+ */
3636
+ upgradeGift ( businessConnectionId , ownedGiftId , form = { } ) {
3637
+ form . business_connection_id = businessConnectionId ;
3638
+ form . owned_gift_id = ownedGiftId ;
3639
+ return this . _request ( 'upgradeGift' , { form } ) ;
3640
+ }
3641
+
3642
+ /**
3643
+ * This method transfers an owned unique gift to another user.
3644
+ *
3645
+ * Requires the **can_transfer_and_upgrade_gifts** business bot right.
3646
+ * Additionally requires the **can_transfer_stars** business bot right **if the transfer is paid**.
3647
+ *
3648
+ * @param {String } businessConnectionId Unique identifier of the business connection.
3649
+ * @param {String } ownedGiftId Unique identifier of the regular gift that should be transferred.
3650
+ * @param {Number } newOwnerChatId Unique identifier of the chat which will own the gift. The chat **must be active in the last 24 hours**.
3651
+ * @param {Object } [options] Additional Telegram query options
3652
+ * @return {Promise } On success, returns True.
3653
+ * @see https://core.telegram.org/bots/api#transfergift
3654
+ */
3655
+ transferGift ( businessConnectionId , ownedGiftId , newOwnerChatId , form = { } ) {
3656
+ form . business_connection_id = businessConnectionId ;
3657
+ form . owned_gift_id = ownedGiftId ;
3658
+ form . new_owner_chat_id = newOwnerChatId ;
3659
+ return this . _request ( 'transferGift' , { form } ) ;
3660
+ }
3661
+
3410
3662
}
3411
3663
3412
3664
module . exports = TelegramBot ;
0 commit comments