Class ClientUser

Hierarchy (view full)

Constructors

Properties

canJoinGroups: boolean

Indicates if the bot can be invited to groups

canReadAllMessages: boolean

Indicates if privacy mode is disabled for the bot

connectBusiness: boolean

Indicates if the bot can be connected to a Telegram Business account

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

inlineQueries: boolean

Indicates if the bot supports inline queries

isBot: true

Indicates 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

mainWebApp: boolean

Indicates if the bot has a main Web App

username: string

The bot's or user'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

  • Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users.

    Parameters

    • Optionalscore: BotCommandScope

      An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault

    • Optionallanguage: string

      A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands

    Returns Promise<true>

    Returns True on success.

  • Checks if this ClientUser is equal to another ClientUser.

    Parameters

    • other: ClientUser

      The other object to compare with.

    Returns boolean

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

  • Use this method to get the current default administrator rights of the bot.

    Parameters

    • OptionalforChannels: boolean

      Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.

    Returns Promise<ChatAdministratorRights>

    Returns ChatAdministratorRights on success.

  • Use this method to get the current list of the bot's commands for the given scope and user language.

    Parameters

    • Optionalscore: BotCommandScope

      An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault

    • Optionallanguage: string

      A two-letter ISO 639-1 language code or an empty string

    Returns Promise<BotCommand[]>

    Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.

  • Use this method to get the current bot description for the given user language.

    Parameters

    • Optionallanguage: string

      A two-letter ISO 639-1 language code or an empty string

    Returns Promise<string>

    Returns bot description on success.

  • Use this method to get the current value of the bot's menu button in a private chat, or the default menu button.

    Parameters

    • OptionalchatId: number

      Unique identifier for the target private chat. If not specified, default bot's menu button will be returned

    Returns Promise<MenuButton>

    Returns MenuButton on success.

  • Use this method to get the current bot name for the given user language.

    Parameters

    • Optionallanguage: string

      A two-letter ISO 639-1 language code or an empty string

    Returns Promise<string>

    Returns bot name on success

  • 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.

  • Use this method to get the current bot short description for the given user language.

    Parameters

    • Optionallanguage: string

      A two-letter ISO 639-1 language code or an empty string

    Returns Promise<string>

    Returns bot short description on success

  • Refunds a successful payment in Telegram Stars.

    Parameters

    • telegramPaymentId: string

      Telegram payment identifier

    Returns Promise<true>

    Returns True on success.

  • Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot.

    Parameters

    • Optionalrights: ChatPermissionFlags

      An object describing new default administrator rights. If not specified, the default administrator rights will be cleared

    • OptionalforChannels: boolean

      Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed

    Returns Promise<true>

    Returns True on success.

  • Use this method to change the list of the bot's commands. See https://core.telegram.org/bots/features#commands for more details about bot commands.

    Parameters

    • commands: readonly BotCommand[]

      A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified

    • Optionalscope: BotCommandScope

      An object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault

    • OptionallanguageCode: string

      A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands

    Returns Promise<true>

    Returns True on success.

  • Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.

    Parameters

    • Optionaldescription: string

      New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language

    • Optionallanguage: string

      A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description

    Returns Promise<true>

    Returns True on success.

  • Use this method to change the bot's menu button in a private chat, or the default menu button.

    Parameters

    • OptionalchatId: number

      Unique identifier for the target private chat. If not specified, default bot's menu button will be changed

    • Optionalmenu: MenuButton

      An object for the bot's new menu button. Defaults to MenuButtonDefault

    Returns Promise<true>

    Returns True on success.

  • Use this method to change the bot's name.

    Parameters

    • Optionalname: string

      New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language

    • Optionallanguage: string

      A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name

    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.

  • Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.

    Parameters

    • Optionaldescription: string

      New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language

    • Optionallanguage: string

      A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description

    Returns Promise<true>

    Returns True on success.