【问题标题】:Sending attachments in embed field在嵌入字段中发送附件
【发布时间】:2018-01-19 04:51:05
【问题描述】:

我正在使用 discord.js,并试图让我的机器人在嵌入字段中发送附件。我试过了,但没有用:

message.channel.send({embed: {
    files: [ "images/twitter.png" ]
}});

我也试过了,还是不行:

message.channel.send({embed: {}, files: [ "images/twitter.png" ]}});

任何帮助将不胜感激!

【问题讨论】:

    标签: discord


    【解决方案1】:

    我最好的猜测是在我看到的指南的底部。

    应该是这样的:

        .setThumbnail("http://i.imgur.com/p2qNFag.png")
    

    希望这适用于您需要做的事情。

    【讨论】:

      【解决方案2】:

      This similar post 可能会有所帮助。发送附件需要 2 个步骤。

      将附件添加到您的邮件中:

      files: [{ attachment: 'images/twitter.png', name: 'twitter.png' }] 
      

      然后将附件添加到您的嵌入中:

      image: { url: "attachment://twitter.png" }    
      

      完整示例:

      message.channel.send({
        embed: {
          description: "This is some text",
          image: {
            url: "attachment://twitter.png"
          }
        },
        files: [{
          attachment: 'images/twitter.png',
          name: 'twitter.png'
        }]
      });
      

      【讨论】:

        猜你喜欢
        • 2021-06-24
        • 2019-11-24
        • 2021-12-01
        • 1970-01-01
        • 2020-12-21
        • 1970-01-01
        • 2020-10-11
        • 2021-02-22
        相关资源
        最近更新 更多