Showing
1 changed file
with
16 additions
and
11 deletions
| ... | @@ -16,6 +16,7 @@ const bodyParser = require('body-parser'); | ... | @@ -16,6 +16,7 @@ const bodyParser = require('body-parser'); |
| 16 | var app = express(); | 16 | var app = express(); |
| 17 | var stack = 0; | 17 | var stack = 0; |
| 18 | var meal, country, cold, spicy; | 18 | var meal, country, cold, spicy; |
| 19 | +var teststring; | ||
| 19 | 20 | ||
| 20 | app.use(bodyParser.json()); | 21 | app.use(bodyParser.json()); |
| 21 | app.post('/hook', function (req, res) { | 22 | app.post('/hook', function (req, res) { |
| ... | @@ -179,6 +180,14 @@ https://developers.naver.com/docs/search/local/ | ... | @@ -179,6 +180,14 @@ https://developers.naver.com/docs/search/local/ |
| 179 | else if(stack == 4 && (eventObj.message.text.indexOf("결과") !== -1)) | 180 | else if(stack == 4 && (eventObj.message.text.indexOf("결과") !== -1)) |
| 180 | { | 181 | { |
| 181 | { | 182 | { |
| 183 | + const option = { | ||
| 184 | + query: '순대', | ||
| 185 | + start: 1, | ||
| 186 | + display: 3, | ||
| 187 | + sort: 'sim', | ||
| 188 | + filter: 'small' | ||
| 189 | + } | ||
| 190 | + ImageSearch(option); | ||
| 182 | 191 | ||
| 183 | request.post( | 192 | request.post( |
| 184 | { | 193 | { |
| ... | @@ -191,8 +200,9 @@ https://developers.naver.com/docs/search/local/ | ... | @@ -191,8 +200,9 @@ https://developers.naver.com/docs/search/local/ |
| 191 | "messages":[ | 200 | "messages":[ |
| 192 | { | 201 | { |
| 193 | "type":"text", | 202 | "type":"text", |
| 194 | - "text":"잠시만 기다려주세요!" // 결과 도출 | 203 | + "text":teststring // 결과 도출 |
| 195 | } | 204 | } |
| 205 | + | ||
| 196 | ] | 206 | ] |
| 197 | } | 207 | } |
| 198 | },(error, response, body) => { | 208 | },(error, response, body) => { |
| ... | @@ -203,14 +213,7 @@ https://developers.naver.com/docs/search/local/ | ... | @@ -203,14 +213,7 @@ https://developers.naver.com/docs/search/local/ |
| 203 | console.log('[request message]', country); | 213 | console.log('[request message]', country); |
| 204 | console.log('[request message]', cold); | 214 | console.log('[request message]', cold); |
| 205 | console.log('[request message]', spicy); | 215 | console.log('[request message]', spicy); |
| 206 | - const option = { | 216 | + |
| 207 | - query: '순대', | ||
| 208 | - start: 1, | ||
| 209 | - display: 3, | ||
| 210 | - sort: 'sim', | ||
| 211 | - filter: 'small' | ||
| 212 | - } | ||
| 213 | - ImageSearch(option); | ||
| 214 | 217 | ||
| 215 | 218 | ||
| 216 | } | 219 | } |
| ... | @@ -287,8 +290,10 @@ function ImageSearch(option) { | ... | @@ -287,8 +290,10 @@ function ImageSearch(option) { |
| 287 | 290 | ||
| 288 | } | 291 | } |
| 289 | }, function(err,res,body){ | 292 | }, function(err,res,body){ |
| 290 | - let json = JSON.parse(body) | 293 | + const json = JSON.parse(body); |
| 291 | - console.log(json) | 294 | + console.log(json.items[0].link); |
| 295 | + teststring = json.items[0].link; | ||
| 296 | + | ||
| 292 | }) | 297 | }) |
| 293 | } | 298 | } |
| 294 | 299 | ... | ... |
-
Please register or login to post a comment