sendGift

Returns: bool

class aiogram.methods.send_gift.SendGift(*, user_id: int, gift_id: str, text: str | None = None, text_parse_mode: str | None = None, text_entities: list[MessageEntity] | None = None, **extra_data: Any)[source]

Sends a gift to the given user. The gift can’t be converted to Telegram Stars by the user. Returns True on success.

Source: https://core.telegram.org/bots/api#sendgift

user_id: int

Unique identifier of the target user that will receive the gift

gift_id: str

Identifier of the gift

text: str | None

Text that will be shown along with the gift; 0-255 characters

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

text_parse_mode: str | None

Mode for parsing entities in the text. See formatting options for more details. Entities other than ‘bold’, ‘italic’, ‘underline’, ‘strikethrough’, ‘spoiler’, and ‘custom_emoji’ are ignored.

text_entities: list[MessageEntity] | None

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’, and ‘custom_emoji’ are ignored.

Usage

As bot method

result: bool = await bot.send_gift(...)

Method as object

Imports:

  • from aiogram.methods.send_gift import SendGift

  • alias: from aiogram.methods import SendGift

With specific bot

result: bool = await bot(SendGift(...))

As reply into Webhook in handler

return SendGift(...)