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
| parameter | type | required | description |
|---|---|---|---|
user_id | number | optional | Required if chat_id is not specified. Unique identifier of the target user who will receive the gift. |
chat_id | number | string | optional | Required 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_id | string | required | Identifier of the gift; limited gifts can't be sent to channel chats |
pay_for_upgrade | boolean | optional | Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver |
text | string | optional | Text that will be shown along with the gift; 0-128 characters |
text_parse_mode | string | optional | Mode 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_entities | MessageEntity[] | optional | A 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.
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.
/** 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">)official Bot API docs: https://core.telegram.org/bots/api/#sendgift