은승우

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) => { ...@@ -73,7 +73,7 @@ app.post('/webhook', line.middleware(config), (req, res) => {
73 // event handler 73 // event handler
74 async function handleEvent(event) { 74 async function handleEvent(event) {
75 console.log(event.type); 75 console.log(event.type);
76 - console.log(event.message.image); 76 + console.log(event.message);
77 77
78 78
79 if (event.type !== 'message' && (event.message.type !== 'text'||event.message.type !== 'image')) { 79 if (event.type !== 'message' && (event.message.type !== 'text'||event.message.type !== 'image')) {
...@@ -82,7 +82,15 @@ async function handleEvent(event) { ...@@ -82,7 +82,15 @@ async 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(async(resolve,reject)=>{ 84 return new Promise(async(resolve,reject)=>{
85 - console.log("!"); 85 + client.getMessageContent(event.message.id)
86 + .then((stream) => {
87 + stream.on('data', (chunk) => {
88 + console.log(chunk);
89 + });
90 + stream.on('error', (err) => {
91 + // error handling
92 + });
93 + });
86 var cheerio = require('cheerio'); 94 var cheerio = require('cheerio');
87 95
88 let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY']; 96 let subscriptionKey = process.env['COMPUTER_VISION_SUBSCRIPTION_KEY'];
......