send_gift()¶
- Client.send_gift()¶
Send a gift to another user or channel chat. May return an error with a message “STARGIFT_USAGE_LIMITED” if the gift was sold out.
Usable by Users Bots- Parameters:
chat_id (
int|str) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).gift_id (
int) – Unique identifier of star gift. To get all available star gifts useget_available_gifts().text (
str, optional) – Text that will be shown along with the gift, 0-128 characters.parse_mode (
ParseMode, optional) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together.entities (List of
MessageEntity, optional) – List of special entities that appear in message text, which can be specified instead of parse_mode.is_private (
bool, optional) – Pass True to show gift text and sender only to the gift receiver. Otherwise, everyone will be able to see them.pay_for_upgrade (
bool, optional) – Pass True to additionally pay for the gift upgrade and allow the receiver to upgrade it for free.
- Returns:
Message– On success, the sent message is returned.
Example
# Send gift await app.send_gift(chat_id=chat_id, gift_id=123)