简体   繁体   中英

Adding image to a message does not work when replying to a message

I am trying to get an image attached to a message which is a replay.

msg.reply(JSON.parse(data).results[0].overview, { file : JSON.parse(data).results[0].poster_path});

but only the "overview" which is a string get sent, without the "poster_path" image.

Why is that and how can I fix it?

I have checked and the JSON data is valid.

To make your code clearer and avoid memory overload, you can call this once


   // get first value
   var firstResult = JSON.parse(data).results[0];

   // confirm the result
   console.log(firstResult);

   // action
   msg.reply(firstResult.overview, { file : firstResult.poster_path});



try view firstResult in the console to confirm the response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM