Available methods

sendGift()

Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.

parameters

parametertyperequireddescription
user_idnumberoptionalRequired if chat_id is not specified. Unique identifier of the target user who will receive the gift.
chat_idnumber | stringoptionalRequired if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @username) that will receive the gift.
gift_idstringrequiredIdentifier of the gift; limited gifts can't be sent to channel chats
pay_for_upgradebooleanoptionalPass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
textstringoptionalText that will be shown along with the gift; 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 { SendGiftParams } from "@yaebal/types";

await bot.api.call<boolean>("sendGift", {
  gift_id: "...",
} satisfies SendGiftParams);

context shortcut

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

context shortcut
/** Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns *True* on success. */
ctx.sendGift(params: Omit<SendGiftParams, "user_id" | "chat_id">)