如何在同一行上使用多个 InlineKeyboardButton 使用 json 创建 inline_keyboard?

How to create inline_keyboard using json with multiple InlineKeyboardButton on same row?

正在寻找 json 负载以在同一行上创建具有多个 InlineKeyboardButtoninline_keyboard

以下代码有效,但每行创建 1 个按钮。

{
  "telegram": {
    "text": "Pick a color",
    "reply_markup": {
      "inline_keyboard": [
        [
          {
            "text": "Red",
            "callback_data": "Red"
          }
        ],        
        [
          {
            "text": "Pink",
            "callback_data": "Pink"
          }
        ]
      ]
    }
  }
}

Dialogflow 中的 Telegram Card 能够创建多个内联按钮,如下所示:

https://core.telegram.org/file/811140217/1/NkRCCLeQZVc/17a804837802700ea4

inline_keyboard consists of rows, each row consists of buttons.

因此只需将按钮添加到第一行(在本例中为 BlueGreen),如下所示:

{
  "telegram": {
    "text": "Pick a color",
    "reply_markup": {
      "inline_keyboard": [
        [
          {
            "text": "Red",
            "callback_data": "Red"
          },
          {
            "text": "Blue",
            "callback_data": "Blue"
          },
          {
            "text": "Green",
            "callback_data": "Green"
          }
        ]
      ]
    }
  }
}