Available methods

giftPremiumSubscription()

Gifts a Telegram Premium subscription to the given user. Returns True on success.

parameters

parametertyperequireddescription
user_idnumberrequiredUnique identifier of the target user who will receive a Telegram Premium subscription
month_countnumberrequiredNumber of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
star_countnumberrequiredNumber of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months
textstringoptionalText that will be shown along with the service message about the subscription; 0-128 characters
text_parse_modestringoptionalMode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.
text_entitiesMessageEntity[]optionalA JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.

returns

boolean

usage in yaebal

not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.

bot.ts
import type { GiftPremiumSubscriptionParams } from "@yaebal/types";

await bot.api.call<boolean>("giftPremiumSubscription", {
  user_id: 123456789,
  month_count: 1,
  star_count: 1,
} satisfies GiftPremiumSubscriptionParams);

context shortcut

also available as ctx.giftPremiumSubscription() on 16 context types — see @yaebal/contexts.

context shortcut
/** Gifts a Telegram Premium subscription to the given user. Returns *True* on success. */
ctx.giftPremiumSubscription(params: Omit<GiftPremiumSubscriptionParams, "user_id">)