Context of a callback query update.

This is a subclass of CallbackQuery, so all its fields are also available.

Hierarchy (View Summary)

Implements

Constructors

Properties

_name: "callback_query" = ...
_peers: PeersIndex

Accessors

  • get chat(): Peer
  • Chat where the originating message was sent

    Returns Peer

  • get data(): null | Uint8Array
  • Data that was contained in the callback button, if any

    Note that this field is defined by the client, and a bad client can send arbitrary data in this field.

    Returns null | Uint8Array

  • get dataStr(): null | string
  • Data that was contained in the callback button, if any, parsed as a UTF8 string

    Note that this field is defined by the client, and a bad client can send arbitrary data in this field.

    Returns null | string

  • get game(): null | string
  • In case this message was from InputInlineResultGame, or the button was BotKeyboard.game, short name of the game that should be returned.

    Returns null | string

  • get id(): Long
  • ID of this callback query

    Returns Long

  • get messageId(): number
  • Identifier of the message containing the button which was clicked.

    Returns number

  • get uniqueChatId(): Long
  • Unique ID, that represents the chat to which the inline message was sent. Does not contain actual chat ID.

    Returns Long

  • get user(): User
  • User who has pressed the button

    Returns User

Methods

  • Answer to this callback query

    Parameters

    • params: undefined | { alert?: boolean; cacheTime?: number; text?: string; url?: string }
      • undefined
      • { alert?: boolean; cacheTime?: number; text?: string; url?: string }
        • Optionalalert?: boolean

          Whether to show an alert in the middle of the screen instead of a notification at the top of the screen.

          false
          
        • OptionalcacheTime?: number

          Maximum amount of time in seconds for which this result can be cached by the client (not server!).

          0
          
        • Optionaltext?: string

          Text of the notification (0-200 chars).

          If not set, nothing will be displayed

        • Optionalurl?: string

          URL that the client should open.

          If this was a button containing a game, you can provide arbitrary link to your game. Otherwise, you can only use links in the format t.me/your_bot?start=... that open your bot with a deep-link parameter.

    Returns Promise<void>

  • Edit the message that contained the callback button that was clicked.

    Parameters

    • params: Omit<
          {
              disableWebPreview?: boolean;
              invertMedia?: boolean;
              media?: InputMediaLike;
              messageId: string
              | TypeInputBotInlineMessageID;
              progressCallback?: (uploaded: number, total: number) => void;
              replyMarkup?: ReplyMarkup;
              text?: InputText;
          },
          "messageId",
      >

    Returns Promise<Message>

  • Shortcut for getting the message and editing it.

    Parameters

    • handler: (
          msg: Message,
      ) => MaybePromise<
          Omit<
              {
                  disableWebPreview?: boolean;
                  invertMedia?: boolean;
                  media?: InputMediaLike;
                  messageId: string
                  | TypeInputBotInlineMessageID;
                  progressCallback?: (uploaded: number, total: number) => void;
                  replyMarkup?: ReplyMarkup;
                  text?: InputText;
              },
              "messageId",
          >,
      >

    Returns Promise<undefined | Message>

  • Get the message containing the callback button being clicked.

    Note that the message may have been deleted, in which case null will be returned.

    Returns Promise<null | Message>