Showing
1 changed file
with
3 additions
and
5 deletions
... | @@ -81,7 +81,7 @@ async function handleEvent(event) { | ... | @@ -81,7 +81,7 @@ async function handleEvent(event) { |
81 | return Promise.resolve(null); | 81 | return Promise.resolve(null); |
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(async(resolve,reject)=>{ |
85 | console.log("!"); | 85 | console.log("!"); |
86 | var cheerio = require('cheerio'); | 86 | var cheerio = require('cheerio'); |
87 | 87 | ||
... | @@ -102,9 +102,7 @@ async function handleEvent(event) { | ... | @@ -102,9 +102,7 @@ async function handleEvent(event) { |
102 | }, | 102 | }, |
103 | body: event.message.image | 103 | body: event.message.image |
104 | }; | 104 | }; |
105 | - | 105 | + await request.post(options, function (error, response, body) { |
106 | - }).resolve((options)=>{ | ||
107 | - request.post(options, function (error, response, body) { | ||
108 | var data=JSON.stringify(body); | 106 | var data=JSON.stringify(body); |
109 | var text=''; | 107 | var text=''; |
110 | console.log(data); | 108 | console.log(data); |
... | @@ -139,7 +137,7 @@ async function handleEvent(event) { | ... | @@ -139,7 +137,7 @@ async function handleEvent(event) { |
139 | } | 137 | } |
140 | client.replyMessage(event.replyToken,result).then(resolve).catch(reject); | 138 | client.replyMessage(event.replyToken,result).then(resolve).catch(reject); |
141 | }); | 139 | }); |
142 | - }) | 140 | + }); |
143 | }) | 141 | }) |
144 | } | 142 | } |
145 | else if(event.type == 'message' && event.message.type == 'text') | 143 | else if(event.type == 'message' && event.message.type == 'text') | ... | ... |
-
Please register or login to post a comment