은승우

Update app.js

Showing 1 changed file with 4 additions and 5 deletions
...@@ -83,15 +83,14 @@ async function handleEvent(event) { ...@@ -83,15 +83,14 @@ async function handleEvent(event) {
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 var file; 85 var file;
86 - while(file!=undefined) 86 +
87 - {
88 client.getMessageContent(event.message.id) 87 client.getMessageContent(event.message.id)
89 - .then((stream) => { 88 + .then(async(stream) => {
90 - stream.on('data', (chunk) => { 89 + await stream.on('data', (chunk) => {
91 file=chunk; 90 file=chunk;
92 }); 91 });
93 }); 92 });
94 - } 93 +
95 var cheerio = require('cheerio'); 94 var cheerio = require('cheerio');
96 var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr'; 95 var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr';
97 var options = { 96 var options = {
......