【问题标题】:Discord.js message attachments pictureDiscord.js 消息附件图片
【发布时间】:2017-05-02 13:39:27
【问题描述】:
message.channel.sendMessage(text).attachments
["",{url:"http://openweathermap.org/img/w/"+icon+".png" }];

我用node-js ( discord.js )做了一些机器人。

我想发送带有图片(不带 URL)的消息,所以我在文档中找到了功能附件。 但是,当我在控制台中输入消息(文本)和附件时,我得到:

“无法读取未定义的属性'# '”

我应该怎么做才能解决这个问题?

【问题讨论】:

    标签: node.js discord


    【解决方案1】:

    根据文档,您需要传递一个包含文件 URL 的对象或 FileOptions 对象。你会这样做

    message.channel.send("some text", {
        file: "http://link.to/your.file" // Or replace with FileOptions object
    });
    

    【讨论】:

      猜你喜欢
      • 2021-10-17
      • 1970-01-01
      • 2019-05-19
      • 2021-05-14
      • 1970-01-01
      • 1970-01-01
      • 2021-09-04
      • 2020-08-24
      • 2020-07-02
      相关资源
      最近更新 更多