Class User

Hierarchy (view full)

Constructors

Properties

firstName: string

User's or bot's first name

id: string

Unique identifier for this user or bot.

inAttachmentMenu?: boolean

True, if this user added the bot to the attachment menu

isBot: boolean

True, if this user is a bot

isPremium?: boolean

True, if this user is a Telegram Premium user

language?: string

IETF language tag of the user's language

lastName?: string

User's or bot's last name

username?: string

User's or bot's username

Accessors

Methods

  • Parameters

    • data: User | UserFromGetMe

      represents a Telegram user or bot

    Returns User | UserFromGetMe

  • 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 user is equal to another user.

    Parameters

    Returns boolean

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

  • Fetches this user

    Parameters

    • Optionalforce: boolean

      Whether to skip the cache check and request the API

    Returns Promise<User>

  • Use this method to get a list of profile pictures for a user.

    Parameters

    • Optionaloffset: number

      Sequential number of the first photo to be returned. By default, all photos are returned

    • Optionallimit: number

      Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100

    Returns Promise<UserProfilePhotos>

    Returns a UserProfilePhotos object.

  • Refunds a successful payment in Telegram Stars.

    Parameters

    • telegramPaymentId: string

      Telegram payment identifier

    Returns Promise<true>

    Returns True on success.

  • Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).

    Parameters

    Returns Promise<true>

    Returns True on success.