Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discord.js message attachments picture

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?

like image 367
Hong-il Yang Avatar asked Dec 16 '16 17:12

Hong-il Yang


1 Answers

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
});
like image 67
Zaidhaan Hussain Avatar answered Sep 27 '22 02:09

Zaidhaan Hussain