Skip to content

sendGift

Function · TDLib 1.8.67 · d1085f9c

Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out

sendGift(
  gift_id: int64,
  owner_id: MessageSender,
  text: FormattedText,
  is_private: Bool,
  pay_for_upgrade: Bool
) → Ok

gift_id

int64

Identifier of the gift to send

owner_id

MessageSender

Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats

text

FormattedText

Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, and DateTime entities are allowed. Must be empty if the receiver enabled paid messages

is_private

Bool

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

Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free