send_gift()#
- Client.send_gift()#
Sends a gift to the given user or channel chat. The gift can’t be converted to Telegram Stars by the receiver.
Usable by Users BotsYou must use exactly one of
user_id
ORchat_id
.- Parameters:
user_id (
int
|str
) – Required ifchat_id
is not specified. Unique identifier (int) or username (str) of the target 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).chat_id (
int
|str
) – Required ifuser_id
is not specified. Unique identifier (int) or username (str) for the chat or username of the channel 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
) – Identifier of the gift.pay_for_upgrade (
bool
, optional) – Pass True to pay for the gift upgrade from the sender’s balance, thereby making the upgrade free for the receiver.text (
str
, optional) – Text that will be shown along with the gift. 0-gift_text_length_max
characters.text_parse_mode (
ParseMode
, optional) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together.text_entities (List of
MessageEntity
, optional) – List of special entities that appear in message text, which can be specified instead of text_parse_mode. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed.is_private (
bool
, optional) – For users only: 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)