send_gift()

Client.send_gift()

Sends a gift to another user.

Usable by Users Bots
Parameters:
  • user_id (int | str) – Unique identifier (int) or username (str) of the user that will receive the gift. 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 the gift to send.

  • text (str, optional) – Text of the message to be sent. 0-gift_text_length_max 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. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed.

  • is_private (bool, optional) – Pass True to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them.

Returns:

bool – On success, True is returned.

Raises:

RPCError – In case of a Telegram RPC error.

Example

# Send gift
app.send_gift(user_id=user_id, gift_id=123)