Class Gift

Hierarchy (View Summary)

Constructors

Properties

id: string

Unique identifier of the gift

remainingCount?: number

The number of remaining gifts of this type that can be sent; for limited gifts only

startCount: number

The number of Telegram Stars that must be paid to send the sticker

sticker: Sticker

The sticker that represents the gift

totalCount?: number

The total number of the gifts of this type that can be sent; for limited gifts only

upgradeStarCount?: number

The number of Telegram Stars that must be paid to upgrade the gift to a unique one

Accessors

Methods

  • Protected

    Creates a clone of the current instance

    Returns Base

    A clone of the current instance

  • Protected

    Patches the current instance with new data

    Parameters

    • data: Record<string, any>

      The data to patch the instance with

    Returns Record<string, any>

    The patched data

  • Protected

    Updates the current instance with new data and returns a clone of the updated instance

    Parameters

    • data: Record<string, any>

      The data to update the instance with

    Returns Base

    A clone of the updated instance

  • Checks if this gift is equal to another gift.

    Parameters

    • other: Gift

      The other object to compare with.

    Returns boolean

    True if both objects are instances of Gift and are equal based on key properties, otherwise false.

  • Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user.

    Parameters

    • userId: string | number

      Unique identifier of the target user that will receive the gift.

    • Optionaloptions: Omit<
          {
              giftId: string;
              pay_for_upgrade?: boolean;
              text?: string;
              textEntities?: MessageEntity[];
              textParseMode?: ParseMode;
              userId: string
              | number;
          },
          "giftId"
          | "userId",
      >

      out parameters.

    Returns Promise<true>

    Returns True on success.

  • Flatten an object. Any properties that are collections will get converted to an array of keys.

    Parameters

    • OptionalpropsRecursive: boolean

      Optional. If true, calls toJSON method on nested objects.

    • ...props: Record<string, string | boolean>[]

      Optional. Specific properties to include/exclude, or rename.

    Returns Record<string, any>

    Flattened object.

  • Returns the id instance Chat, User, ChatMember and other

    Returns null | string