Discord.js message attachments picture

橙三吉。 提交于 2019-12-10 09:26:38

问题


message.channel.sendMessage(text).attachments
["",{url:"http://openweathermap.org/img/w/"+icon+".png" }];

I made some bot, with node-js ( discord.js ).

I want to send message with picture(without URL) so, I found fuction attachments, in documentation. But, when I put in message (text) and attachments some picture, in the console,I get:

"Cannot read property '# < Object >' of undefined"

What should I do fix this problem?


回答1:


According to the docs, you will need to pass an object containing the file URL or a FileOptions object. You would do this like

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


来源:https://stackoverflow.com/questions/41189796/discord-js-message-attachments-picture

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!