通过机器人发送电报时如何指定视频的尺寸(高度,宽度)?

How do I specify the dimensions of the video (height, width) when sending telegrams by bot?

我使用 node-telegram-bot-api 库。发送视频时如何指定视频大小?

// where to specify height and width ?
bot.sendVideo(
  chatId,
  video,
  { caption: 'my video' },
  { filename: 'my_file' }, 
)

电报 API 允许您指定大小,但在我看来 sendVideo 方法不允许您指定它们。是这样吗?

p.s.: 我试图通过选项参数传递高度和宽度。

bot.sendVideo(
    chatId,
    `video`,
    {
        caption: 'my video',
        height: 720,
        width: 1280
    },
    {filename:'my_file'}
)
    .then(res=>{console.log(res)})

但是对于高度和宽度参数的任何参数,我得到相同的答案。

video: {
    duration: 8,
    width: 1080,
    height: 1920,
    file_name: 'my_video',
    mime_type: 'video/mp4',
    thumb: {
      file_id: '***',
      file_unique_id: '***',
      file_size: 12743,
      width: 180,
      height: 320
    },
    file_id: '***',
    file_unique_id: '***',
    file_size: 4938678
  },

如果你检查 node-telegram-bot-api 库的 GitHub repo,你可以看到 sendVideo() 方法接受一个 options 对象作为存储额外电报查询选项的第三个参数.

您已经传递了一个带有 caption 键的对象,您可以在其中添加更多对象,例如 heightwidthduration 等。 Telegram docs.

上提供了这些选项的完整列表
bot.sendVideo(
  chatId,
  video,
  {
    caption: 'my video',
    height: 720,
    width: 1280,
  },
  { filename: 'my_file' }, 
)