小编Mat*_*tia的帖子

Telegraf.js 在 sendPhoto 上添加带有标记的按钮

我有bot.telegram.sendPhoto()这个代码:

bot.telegram.sendPhoto(
  channel_id,
  {source: filepath},
  { 
    caption: description.join("\n"), 
    parse_mode: 'MarkdownV2'
  }
)
Run Code Online (Sandbox Code Playgroud)

(描述是一个带有一些文本的数组。

所以我想添加一些按钮,然后执行一个操作,但我该怎么办?我已经尝试过这样的方式:

const buttons = Markup.keyboard([
            ["Test", "Test2"]
        ]).oneTime().resize().extra()
Run Code Online (Sandbox Code Playgroud)

然后将其添加到 parse_mode 之后的 {...} 中:

{ 
  caption: description.join("\n"), 
  parse_mode: 'MarkdownV2',
  buttons
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用。我也在 {...} 之后尝试过

{ 
  caption: description.join("\n"), 
  parse_mode: 'MarkdownV2'
},
buttons
Run Code Online (Sandbox Code Playgroud)

但它仍然不起作用。那我该怎么办呢?谢谢

node.js telegraf telegraf.js telegram-api

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

node.js ×1

telegraf ×1

telegraf.js ×1

telegram-api ×1