Showing
1 changed file
with
9 additions
and
1 deletions
... | @@ -82,12 +82,20 @@ function handleEvent(event) { | ... | @@ -82,12 +82,20 @@ function handleEvent(event) { |
82 | } | 82 | } |
83 | else if (event.type == 'message'&& event.message.type == 'image') { | 83 | else if (event.type == 'message'&& event.message.type == 'image') { |
84 | return new Promise((resolve,reject)=>{ | 84 | return new Promise((resolve,reject)=>{ |
85 | + client.getMessageContent(event.message.id).then((stream) => { | ||
86 | + stream.on('data', (chunk) => { | ||
85 | request.post( function(error, response, body){ | 87 | request.post( function(error, response, body){ |
86 | // Translate API Sucess | 88 | // Translate API Sucess |
87 | if(!error && response.statusCode == 200){ | 89 | if(!error && response.statusCode == 200){ |
88 | - client.replyMessage(event.replyToken,event.message.originalContentUrl).then(resolve).catch(reject); | 90 | + client.replyMessage(event.replyToken,chunk).then(resolve).catch(reject); |
89 | } | 91 | } |
90 | }); | 92 | }); |
93 | + stream.on('error', (err) => { | ||
94 | + // error handling | ||
95 | + }); | ||
96 | + }); | ||
97 | + | ||
98 | + }); | ||
91 | /*console.log("!"); | 99 | /*console.log("!"); |
92 | var cheerio = require('cheerio'); | 100 | var cheerio = require('cheerio'); |
93 | 101 | ... | ... |
-
Please register or login to post a comment