@@ -26,6 +26,7 @@ import {
2626 InputMediaPhoto ,
2727 InputMediaVideo ,
2828 InputPollOption ,
29+ InputProfilePhoto ,
2930 UserProfilePhotos ,
3031 ChatPermissions ,
3132 ChatInviteLink ,
@@ -65,6 +66,12 @@ import {
6566 WebhookInfo ,
6667 Currencies ,
6768 Gifts ,
69+ AcceptedGiftTypes ,
70+ StarAmount ,
71+ OwnedGifts ,
72+ InputStoryContent ,
73+ Story ,
74+ StoryArea ,
6875} from './types/' ;
6976import * as TelegramTypes from './types/' ;
7077import { ExactlyOne } from './utils' ;
@@ -2663,6 +2670,315 @@ export class TelegramBot extends EventEmitter {
26632670 return await this . callApi ( 'removeChatVerification' , options ) ;
26642671 }
26652672
2673+ /**
2674+ * ## readBusinessMessage
2675+ * Marks incoming message as read on behalf of a business account. Requires
2676+ * the can_read_messages business bot right.
2677+ * Returns True on success.
2678+ * @see https://core.telegram.org/bots/api#readbusinessmessage
2679+ */
2680+ async readBusinessMessage ( options : {
2681+ business_connection_id : string ;
2682+ chat_id : number | string ;
2683+ message_id : number ;
2684+ } ) : Promise < true > {
2685+ return await this . callApi ( 'readBusinessMessage' , options ) ;
2686+ }
2687+
2688+ /**
2689+ * ## deleteBusinessMessages
2690+ * Delete messages on behalf of a business account. Requires
2691+ * the can_delete_sent_messages business bot right to delete messages sent by
2692+ * the bot itself, or the can_delete_all_messages business bot right to delete
2693+ * any message. Returns True on success.
2694+ * @see https://core.telegram.org/bots/api#deletebusinessmessages
2695+ */
2696+ async deleteBusinessMessages ( options : {
2697+ business_connection_id : string ;
2698+ message_ids : number [ ] ;
2699+ } ) : Promise < true > {
2700+ return await this . callApi ( 'deleteBusinessMessages' , options ) ;
2701+ }
2702+
2703+ /**
2704+ * ## setBusinessAccountName
2705+ * Changes the first and last name of a managed business account. Requires the
2706+ * can_change_name business bot right.
2707+ * Returns True on success.
2708+ * @see https://core.telegram.org/bots/api#setbusinessaccountname
2709+ */
2710+ async setBusinessAccountName ( options : {
2711+ business_connection_id : string ;
2712+ first_name : string ;
2713+ last_name ?: string ;
2714+ } ) : Promise < true > {
2715+ return await this . callApi ( 'setBusinessAccountName' , options ) ;
2716+ }
2717+
2718+ /**
2719+ * ## setBusinessAccountUsername
2720+ * Changes the username of a managed business account. Requires the
2721+ * can_change_username business bot right.
2722+ * Returns True on success.
2723+ * @see https://core.telegram.org/bots/api#setbusinessaccountusername
2724+ */
2725+ async setBusinessAccountUsername ( options : {
2726+ business_connection_id : string ;
2727+ username : string ;
2728+ } ) : Promise < true > {
2729+ return await this . callApi ( 'setBusinessAccountUsername' , options ) ;
2730+ }
2731+
2732+ /**
2733+ * ## setBusinessAccountBio
2734+ * Changes the bio of a managed business account. Requires the
2735+ * can_change_bio business bot right.
2736+ * Returns True on success.
2737+ * @see https://core.telegram.org/bots/api#setbusinessaccountbio
2738+ */
2739+ async setBusinessAccountBio ( options : {
2740+ business_connection_id : string ;
2741+ bio : string ;
2742+ } ) : Promise < true > {
2743+ return await this . callApi ( 'setBusinessAccountBio' , options ) ;
2744+ }
2745+
2746+ /**
2747+ * ## setBusinessAccountProfilePhoto
2748+ * Changes the profile photo of a managed business account. Requires the
2749+ * can_edit_profile_photo business bot right.
2750+ * Returns True on success.
2751+ * @see https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
2752+ */
2753+ async setBusinessAccountProfilePhoto ( options : {
2754+ business_connection_id : string ;
2755+ photo : InputProfilePhoto ;
2756+ is_public ?: boolean ;
2757+ } ) : Promise < true > {
2758+ return await this . callApi ( 'setBusinessAccountProfilePhoto' , {
2759+ ...options ,
2760+ photo : new JSONSerialized ( options . photo ) ,
2761+ } ) ;
2762+ }
2763+
2764+ /**
2765+ * ## removeBusinessAccountProfilePhoto
2766+ * Removes the current profile photo of a managed business account.
2767+ * Requires the can_edit_profile_photo business bot right.
2768+ * Returns True on success.
2769+ * @see https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
2770+ */
2771+ async removeBusinessAccountProfilePhoto ( options : {
2772+ business_connection_id : string ;
2773+ is_public ?: boolean ;
2774+ } ) : Promise < true > {
2775+ return await this . callApi ( 'removeBusinessAccountProfilePhoto' , options ) ;
2776+ }
2777+
2778+ /**
2779+ * ## setBusinessAccountGiftSettings
2780+ * Changes the privacy settings pertaining to incoming gifts in a managed
2781+ * business account. Requires the can_change_gift_settings business bot right.
2782+ * Returns True on success.
2783+ * @see https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
2784+ */
2785+ async setBusinessAccountGiftSettings ( options : {
2786+ business_connection_id : string ;
2787+ show_gift_button : boolean ;
2788+ accepted_gift_types : AcceptedGiftTypes ;
2789+ } ) : Promise < true > {
2790+ return await this . callApi ( 'setBusinessAccountGiftSettings' , {
2791+ ...options ,
2792+ accepted_gift_types : new JSONSerialized ( options . accepted_gift_types ) ,
2793+ } ) ;
2794+ }
2795+
2796+ /**
2797+ * ## getBusinessAccountStarBalance
2798+ * Returns the amount of Telegram Stars owned by a managed business account.
2799+ * Requires the can_view_gifts_and_stars business bot right.
2800+ * Returns StarAmount on success.
2801+ * @see https://core.telegram.org/bots/api#getbusinessaccountstarbalance
2802+ */
2803+ async getBusinessAccountStarBalance ( options : {
2804+ business_connection_id : string ;
2805+ } ) : Promise < StarAmount > {
2806+ return await this . callApi ( 'getBusinessAccountStarBalance' , options ) ;
2807+ }
2808+
2809+ /**
2810+ * ## transferBusinessAccountStars
2811+ * Transfers Telegram Stars from the business account balance to the bot's
2812+ * balance. Requires the can_transfer_stars business bot right.
2813+ * Returns True on success.
2814+ * @see https://core.telegram.org/bots/api#transferbusinessaccountstars
2815+ */
2816+ async transferBusinessAccountStars ( options : {
2817+ business_connection_id : string ;
2818+ star_count : number ;
2819+ } ) : Promise < true > {
2820+ return await this . callApi ( 'transferBusinessAccountStars' , options ) ;
2821+ }
2822+
2823+ /**
2824+ * ## getBusinessAccountGifts
2825+ * Returns the gifts received and owned by a managed business account.
2826+ * Requires the can_view_gifts_and_stars business bot right.
2827+ * Returns OwnedGifts on success.
2828+ * @see https://core.telegram.org/bots/api#getbusinessaccountgifts
2829+ */
2830+ async getBusinessAccountGifts ( options : {
2831+ business_connection_id : string ;
2832+ exclude_unsaved ?: boolean ;
2833+ exclude_saved ?: boolean ;
2834+ exclude_unlimited ?: boolean ;
2835+ exclude_limited ?: boolean ;
2836+ exclude_unique ?: boolean ;
2837+ sort_by_price ?: boolean ;
2838+ offset ?: string ;
2839+ limit ?: number ;
2840+ } ) : Promise < OwnedGifts > {
2841+ return await this . callApi ( 'getBusinessAccountGifts' , {
2842+ ...options ,
2843+ } ) ;
2844+ }
2845+
2846+ /**
2847+ * ## convertGiftToStars
2848+ * Converts a given regular gift to Telegram Stars. Requires the
2849+ * can_convert_gifts_to_stars business bot right.
2850+ * Returns True on success.
2851+ * @see https://core.telegram.org/bots/api#convertgifttostars
2852+ */
2853+ async convertGiftToStars ( options : {
2854+ business_connection_id : string ;
2855+ owned_gift_id : string ;
2856+ } ) : Promise < true > {
2857+ return await this . callApi ( 'convertGiftToStars' , options ) ;
2858+ }
2859+
2860+ /**
2861+ * ## upgradeGift
2862+ * Upgrades a given regular gift to a unique gift. Requires the
2863+ * can_transfer_and_upgrade_gifts business bot right. Additionally requires
2864+ * the can_transfer_stars business bot right if the upgrade is paid.
2865+ * Returns True on success.
2866+ * @see https://core.telegram.org/bots/api#upgradegift
2867+ */
2868+ async upgradeGift ( options : {
2869+ business_connection_id : string ;
2870+ owned_gift_id : string ;
2871+ keep_original_details ?: boolean ;
2872+ star_count ?: number ;
2873+ } ) : Promise < true > {
2874+ return await this . callApi ( 'upgradeGift' , {
2875+ ...options ,
2876+ } ) ;
2877+ }
2878+
2879+ /**
2880+ * ## transferGift
2881+ * Transfers an owned unique gift to another user. Requires the
2882+ * can_transfer_and_upgrade_gifts business bot right. Requires
2883+ * can_transfer_stars business bot right if the transfer is paid.
2884+ * Returns True on success.
2885+ * @see https://core.telegram.org/bots/api#transfertgift
2886+ */
2887+ async transferGift ( options : {
2888+ business_connection_id : string ;
2889+ owned_gift_id : string ;
2890+ new_owner_chat_id : number ;
2891+ star_count ?: number ;
2892+ } ) : Promise < true > {
2893+ return await this . callApi ( 'transferGift' , {
2894+ ...options ,
2895+ } ) ;
2896+ }
2897+
2898+ /**
2899+ * ## postStory
2900+ * Posts a story on behalf of a managed business account. Requires the
2901+ * can_manage_stories business bot right.
2902+ * Returns Story on success.
2903+ * @see https://core.telegram.org/bots/api#poststory
2904+ */
2905+ async postStory ( options : {
2906+ business_connection_id : string ;
2907+ content : InputStoryContent ;
2908+ active_period : number ;
2909+ caption ?: string ;
2910+ parse_mode ?: string ;
2911+ caption_entities ?: MessageEntity [ ] ;
2912+ areas ?: StoryArea [ ] ;
2913+ post_to_chat_page ?: boolean ;
2914+ protect_content ?: boolean ;
2915+ } ) : Promise < Story > {
2916+ return await this . callApi ( 'postStory' , {
2917+ ...options ,
2918+ caption_entities : new JSONSerialized ( options . caption_entities ) ,
2919+ content : new JSONSerialized ( options . content ) ,
2920+ areas : new JSONSerialized ( options . areas ) ,
2921+ } ) ;
2922+ }
2923+
2924+ /**
2925+ * ## editStory
2926+ * Edits a story previously posted by the bot on behalf of a managed business
2927+ * account. Requires the can_manage_stories business bot right.
2928+ * Returns Story on success.
2929+ * @see https://core.telegram.org/bots/api#editstory
2930+ */
2931+ async editStory ( options : {
2932+ business_connection_id : string ;
2933+ story_id : string ;
2934+ content ?: InputStoryContent ;
2935+ caption ?: string ;
2936+ parse_mode ?: string ;
2937+ caption_entities ?: MessageEntity [ ] ;
2938+ areas ?: StoryArea [ ] ;
2939+ } ) : Promise < Story > {
2940+ return await this . callApi ( 'editStory' , {
2941+ ...options ,
2942+ caption_entities : new JSONSerialized ( options . caption_entities ) ,
2943+ content : options . content ? new JSONSerialized ( options . content ) : undefined ,
2944+ areas : options . areas ? new JSONSerialized ( options . areas ) : undefined ,
2945+ } ) ;
2946+ }
2947+
2948+ /**
2949+ * ## deleteStory
2950+ * Deletes a story previously posted by the bot on behalf of a managed
2951+ * business account. Requires the can_manage_stories business bot right.
2952+ * Returns True on success.
2953+ * @see https://core.telegram.org/bots/api#deletestory
2954+ */
2955+ async deleteStory ( options : {
2956+ business_connection_id : string ;
2957+ story_id : string ;
2958+ } ) : Promise < true > {
2959+ return await this . callApi ( 'deleteStory' , options ) ;
2960+ }
2961+
2962+ /**
2963+ * ## giftPremiumSubscription
2964+ * Gifts a Telegram Premium subscription to the given user.
2965+ * Returns True on success.
2966+ * @see https://core.telegram.org/bots/api#giftpremiumsubscription
2967+ */
2968+ async giftPremiumSubscription ( options : {
2969+ user_id : number ;
2970+ month_count : number ;
2971+ star_count : number ;
2972+ text ?: string ;
2973+ text_parse_mode ?: string ;
2974+ text_entities ?: MessageEntity [ ] ;
2975+ } ) : Promise < true > {
2976+ return await this . callApi ( 'giftPremiumSubscription' , {
2977+ ...options ,
2978+ text_entities : new JSONSerialized ( options . text_entities ) ,
2979+ } ) ;
2980+ }
2981+
26662982 on < U extends keyof allEmittedTypes > ( event : U , listener : ( eventData : NonNullable < allEmittedTypes [ U ] > ) => void ) : this {
26672983 return super . on ( event , listener ) as this;
26682984 }
0 commit comments