은승우

Update app.js

Showing 1 changed file with 4 additions and 3 deletions
......@@ -85,11 +85,12 @@ async function handleEvent(event) {
}
else if (event.type == 'message'&& event.message.type == 'image') {
return new Promise(async(resolve,reject)=>{
var file;
client.getMessageContent(event.message.id)
.then((stream) => {
stream.on('data', (chunk) => {
fs.writeFileSync('./photo/1.png',chunk);
fs.writeFileSync('/photo/1.png',chunk);
file=chunk;
});
});
......@@ -106,7 +107,7 @@ async function handleEvent(event) {
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': '979dc5d63344438fa4701c62feebb7dc'
},
body: chunk
body: file
};
console.log(body);
request.post(options, function (error, response, body) {
......