은승우

Update app.js

Showing 1 changed file with 10 additions and 2 deletions
......@@ -73,7 +73,7 @@ app.post('/webhook', line.middleware(config), (req, res) => {
// event handler
async function handleEvent(event) {
console.log(event.type);
console.log(event.message.image);
console.log(event.message);
if (event.type !== 'message' && (event.message.type !== 'text'||event.message.type !== 'image')) {
......@@ -82,7 +82,15 @@ async function handleEvent(event) {
}
else if (event.type == 'message'&& event.message.type == 'image') {
return new Promise(async(resolve,reject)=>{
console.log("!");
client.getMessageContent(event.message.id)
.then((stream) => {
stream.on('data', (chunk) => {
console.log(chunk);
});
stream.on('error', (err) => {
// error handling
});
});
var cheerio = require('cheerio');
let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
......