KeyboardButton Class

Represents one button of the reply keyboard. For simple text buttons can be used instead of this object to specify text of the button. Optional fields request_contact, request_location, and request_poll are mutually exclusive.

Properties

  • requestChat: KeyboardButtonRequestChat
  • requestContact: boolean
  • requestLocation: boolean
  • requestPoll: KeyboardButtonPollType
  • requestUser: KeyboardButtonRequestUser
  • text: string
  • webApp: WebAppInfo

Methods

  • setRequestChat(requestChat: KeyboardButtonRequestChat)
  • setRequestContact(requestContact: boolean)
  • setRequestLocation(requestLocation: boolean)
  • setRequestPoll(requestPoll: KeyboardButtonPollType)
  • setRequestUser(requestUser: KeyboardButtonRequestUser)
  • setText(text: string)
  • setWebApp(webApp: WebAppInfo)
  • toJSON()
{
  "id": 1421,
  "name": "KeyboardButton",
  "variant": "declaration",
  "kind": 128,
  "flags": {},
  "comment": {
    "summary": [
      {
        "kind": "text",
        "text": "Represents one button of the reply keyboard.\nFor simple text buttons can be used instead of this object to specify text of the button.\nOptional fields request_contact, request_location, and request_poll are mutually exclusive."
      }
    ]
  },
  "children": [
    {
      "id": 1422,
      "name": "constructor",
      "variant": "declaration",
      "kind": 512,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 46,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1423,
          "name": "new KeyboardButton",
          "variant": "signature",
          "kind": 16384,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 46,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1424,
              "name": "data",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "reference",
                "target": 2361,
                "name": "KeyboardButtonData",
                "package": "tgkit"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1427,
      "name": "requestChat",
      "variant": "declaration",
      "kind": 1024,
      "flags": {
        "isOptional": true
      },
      "comment": {
        "summary": [
          {
            "kind": "text",
            "text": "If specified, pressing the button will open a list of suitable chats"
          }
        ]
      },
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 20,
          "character": 1
        }
      ],
      "type": {
        "type": "reference",
        "target": 2725,
        "name": "KeyboardButtonRequestChat",
        "package": "tgkit"
      }
    },
    {
      "id": 1428,
      "name": "requestContact",
      "variant": "declaration",
      "kind": 1024,
      "flags": {
        "isOptional": true
      },
      "comment": {
        "summary": [
          {
            "kind": "text",
            "text": "If *true*, the user's phone number will be sent as a contact when the button is pressed.\nAvailable in private chats only."
          }
        ]
      },
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 26,
          "character": 1
        }
      ],
      "type": {
        "type": "intrinsic",
        "name": "boolean"
      }
    },
    {
      "id": 1429,
      "name": "requestLocation",
      "variant": "declaration",
      "kind": 1024,
      "flags": {
        "isOptional": true
      },
      "comment": {
        "summary": [
          {
            "kind": "text",
            "text": "If *true*, the user's current location will be sent when the button is pressed.\nAvailable in private chats only"
          }
        ]
      },
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 32,
          "character": 1
        }
      ],
      "type": {
        "type": "intrinsic",
        "name": "boolean"
      }
    },
    {
      "id": 1430,
      "name": "requestPoll",
      "variant": "declaration",
      "kind": 1024,
      "flags": {
        "isOptional": true
      },
      "comment": {
        "summary": [
          {
            "kind": "text",
            "text": "If specified, the user will be asked to create a poll and send it to the bot when the button is pressed.\nAvailable in private chats only"
          }
        ]
      },
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 38,
          "character": 1
        }
      ],
      "type": {
        "type": "reference",
        "target": 2059,
        "name": "KeyboardButtonPollType",
        "package": "tgkit"
      }
    },
    {
      "id": 1426,
      "name": "requestUser",
      "variant": "declaration",
      "kind": 1024,
      "flags": {
        "isOptional": true
      },
      "comment": {
        "summary": [
          {
            "kind": "text",
            "text": "If specified, pressing the button will open a list of suitable users"
          }
        ]
      },
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 17,
          "character": 1
        }
      ],
      "type": {
        "type": "reference",
        "target": 2718,
        "name": "KeyboardButtonRequestUser",
        "package": "tgkit"
      }
    },
    {
      "id": 1425,
      "name": "text",
      "variant": "declaration",
      "kind": 1024,
      "flags": {
        "isOptional": true
      },
      "comment": {
        "summary": [
          {
            "kind": "text",
            "text": "Text of the button.\nIf none of the optional fields are used, it will be sent as a message when the button is pressed"
          }
        ]
      },
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 14,
          "character": 1
        }
      ],
      "type": {
        "type": "intrinsic",
        "name": "string"
      }
    },
    {
      "id": 1431,
      "name": "webApp",
      "variant": "declaration",
      "kind": 1024,
      "flags": {
        "isOptional": true
      },
      "comment": {
        "summary": [
          {
            "kind": "text",
            "text": "If specified, the described Web App will be launched when the button is pressed.\nAvailable in private chats only."
          }
        ]
      },
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 44,
          "character": 1
        }
      ],
      "type": {
        "type": "reference",
        "target": 2334,
        "name": "WebAppInfo",
        "package": "tgkit"
      }
    },
    {
      "id": 1438,
      "name": "setRequestChat",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 66,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1439,
          "name": "setRequestChat",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 66,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1440,
              "name": "requestChat",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "reference",
                "target": 2725,
                "name": "KeyboardButtonRequestChat",
                "package": "tgkit"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1441,
      "name": "setRequestContact",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 71,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1442,
          "name": "setRequestContact",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 71,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1443,
              "name": "requestContact",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "intrinsic",
                "name": "boolean"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1444,
      "name": "setRequestLocation",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 76,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1445,
          "name": "setRequestLocation",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 76,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1446,
              "name": "requestLocation",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "intrinsic",
                "name": "boolean"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1447,
      "name": "setRequestPoll",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 81,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1448,
          "name": "setRequestPoll",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 81,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1449,
              "name": "requestPoll",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "reference",
                "target": 2059,
                "name": "KeyboardButtonPollType",
                "package": "tgkit"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1435,
      "name": "setRequestUser",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 61,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1436,
          "name": "setRequestUser",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 61,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1437,
              "name": "requestUser",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "reference",
                "target": 2718,
                "name": "KeyboardButtonRequestUser",
                "package": "tgkit"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1432,
      "name": "setText",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 56,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1433,
          "name": "setText",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 56,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1434,
              "name": "text",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "intrinsic",
                "name": "string"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1450,
      "name": "setWebApp",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 86,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1451,
          "name": "setWebApp",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 86,
              "character": 1
            }
          ],
          "parameters": [
            {
              "id": 1452,
              "name": "webApp",
              "variant": "param",
              "kind": 32768,
              "flags": {},
              "type": {
                "type": "reference",
                "target": 2334,
                "name": "WebAppInfo",
                "package": "tgkit"
              }
            }
          ],
          "type": {
            "type": "reference",
            "target": 1421,
            "name": "KeyboardButton",
            "package": "tgkit",
            "qualifiedName": "default"
          }
        }
      ]
    },
    {
      "id": 1453,
      "name": "toJSON",
      "variant": "declaration",
      "kind": 2048,
      "flags": {},
      "sources": [
        {
          "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
          "line": 91,
          "character": 1
        }
      ],
      "signatures": [
        {
          "id": 1454,
          "name": "toJSON",
          "variant": "signature",
          "kind": 4096,
          "flags": {},
          "sources": [
            {
              "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
              "line": 91,
              "character": 1
            }
          ],
          "type": {
            "type": "intrinsic",
            "name": "object"
          }
        }
      ]
    }
  ],
  "groups": [
    {
      "title": "Constructors",
      "children": [
        1422
      ]
    },
    {
      "title": "Properties",
      "children": [
        1427,
        1428,
        1429,
        1430,
        1426,
        1425,
        1431
      ]
    },
    {
      "title": "Methods",
      "children": [
        1438,
        1441,
        1444,
        1447,
        1435,
        1432,
        1450,
        1453
      ]
    }
  ],
  "sources": [
    {
      "fileName": "packages/tgkit/src/structures/KeyboardButton.ts",
      "line": 9,
      "character": 21
    }
  ]
}