Open hoangvu12 opened 4 years ago
Try using built-in https
module.
const url = 'https://preview.redd.it/jcqql8h8x1351.jpg?width=640&crop=smart&auto=webp&s=61148c911a1d5155e7d1451105d18241671cf5f0';
https.get(url).on('response', (stream) {
api.sendMessage({ attachments: [stream] }, event.threadID);
});
Try using built-in
https
module.const url = 'https://preview.redd.it/jcqql8h8x1351.jpg?width=640&crop=smart&auto=webp&s=61148c911a1d5155e7d1451105d18241671cf5f0'; https.get(url).on('response', (stream) { api.sendMessage({ attachments: [stream] }, event.threadID); });
Thank you for your reply.
I think your code is a bit wrong.
const url = 'https://preview.redd.it/jcqql8h8x1351.jpg?width=640&crop=smart&auto=webp&s=61148c911a1d5155e7d1451105d18241671cf5f0';
https.get(url).on('response', (stream) => {
api.sendMessage({ attachment: [stream] }, event.threadID);
});
I've tried your way, but it seems it didn't work for me.
Thanks anyway :)
Try using built-in
https
module.const url = 'https://preview.redd.it/jcqql8h8x1351.jpg?width=640&crop=smart&auto=webp&s=61148c911a1d5155e7d1451105d18241671cf5f0'; https.get(url).on('response', (stream) { api.sendMessage({ attachments: [stream] }, event.threadID); });
Thank you for your reply.
I think your code is a bit wrong.
const url = 'https://preview.redd.it/jcqql8h8x1351.jpg?width=640&crop=smart&auto=webp&s=61148c911a1d5155e7d1451105d18241671cf5f0'; https.get(url).on('response', (stream) => { api.sendMessage({ attachment: [stream] }, event.threadID); });
I've tried your way, but it seems it didn't work for me.
Thanks anyway :)
attachments
, not attachment
Try using built-in
https
module.const url = 'https://preview.redd.it/jcqql8h8x1351.jpg?width=640&crop=smart&auto=webp&s=61148c911a1d5155e7d1451105d18241671cf5f0'; https.get(url).on('response', (stream) { api.sendMessage({ attachments: [stream] }, event.threadID); });
Thank you for your reply. I think your code is a bit wrong.
const url = 'https://preview.redd.it/jcqql8h8x1351.jpg?width=640&crop=smart&auto=webp&s=61148c911a1d5155e7d1451105d18241671cf5f0'; https.get(url).on('response', (stream) => { api.sendMessage({ attachment: [stream] }, event.threadID); });
I've tried your way, but it seems it didn't work for me. Thanks anyway :)
attachments
, notattachment
https://github.com/Schmavery/facebook-chat-api/blob/master/DOCS.md#apisendmessagemessage-threadid-callback-messageid
I don't find anything said about attachments in api.sendMessage.
if you want to send multiple attachments, then the array should do it's job
How to add stream to array to send multiple attachments?
I want to send attachments without downloading it locally. So I wonder if there is anyway to create a readable stream from a given url. This is what I've tried so far...
Sorry for my bad english ;)