sendGift¶
Returns: bool
- class aiogram.methods.send_gift.SendGift(*, gift_id: str, user_id: int | None = None, chat_id: int | str | None = None, pay_for_upgrade: bool | None = None, 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 or channel chat. The gift can’t be converted to Telegram Stars by the receiver. Returns
True
on success.Source: https://core.telegram.org/bots/api#sendgift
- gift_id: str¶
Identifier of the gift
- user_id: int | None¶
Required if chat_id is not specified. Unique identifier of the target user who will receive the gift.
- chat_id: ChatIdUnion | None¶
Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format
@channelusername
) that will receive the gift.
- pay_for_upgrade: bool | None¶
Pass
True
to pay for the gift upgrade from the bot’s balance, thereby making the upgrade free for the receiver
- text: str | None¶
Text that will be shown along with the gift; 0-255 characters
- 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(...)