Discord.js message attachments picture

47.5k views Asked by At
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

There are 1 answers

0
Zaidhaan Hussain On

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
});