Showing
1 changed file
with
81 additions
and
0 deletions
| ... | @@ -76,6 +76,87 @@ apiRouter.post('/question1', (req, res) => { | ... | @@ -76,6 +76,87 @@ apiRouter.post('/question1', (req, res) => { |
| 76 | res.status(200).send(responseBody); | 76 | res.status(200).send(responseBody); |
| 77 | }); | 77 | }); |
| 78 | 78 | ||
| 79 | +apiRouter.post('/question2', (req, res) => { | ||
| 80 | + var userId = req.body.userRequest.user.id; | ||
| 81 | + var mesg = req.body.userRequest.utterance; | ||
| 82 | + console.log('[q2:user message] ', mesg); | ||
| 83 | + var mbti = ''; | ||
| 84 | + if (mesg == "네") { | ||
| 85 | + mbti = 'E'; | ||
| 86 | + } else if (mesg == "아니오") { | ||
| 87 | + mbti = 'I'; | ||
| 88 | + } | ||
| 89 | + userDB[userId][0] += mbti; | ||
| 90 | + console.log(userDB[userId]); | ||
| 91 | + const responseBody = { | ||
| 92 | + version: "2.0", | ||
| 93 | + template: { | ||
| 94 | + outputs: [ | ||
| 95 | + { | ||
| 96 | + simpleText: { | ||
| 97 | + text: '평소 깻잎논쟁에 대해 1시간 이상을 생각해 보는 편입니다.' | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + ], | ||
| 101 | + quickReplies: [ | ||
| 102 | + { | ||
| 103 | + action: "block", | ||
| 104 | + label: "네", | ||
| 105 | + message: "네", | ||
| 106 | + blockId: "6297b122ab89e678ee86b331" | ||
| 107 | + }, | ||
| 108 | + { | ||
| 109 | + action: "block", | ||
| 110 | + label: "아니오", | ||
| 111 | + message: "아니오", | ||
| 112 | + blockId: "6297b122ab89e678ee86b331" | ||
| 113 | + } | ||
| 114 | + ] | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + res.status(200).send(responseBody); | ||
| 118 | +}); | ||
| 119 | + | ||
| 120 | +apiRouter.post('/question3', function(req, res) { | ||
| 121 | + var userId = req.body.userRequest.user.id; | ||
| 122 | + var mesg = req.body.userRequest.utterance; | ||
| 123 | + console.log('[q3:user message] ', mesg); | ||
| 124 | + var mbti = ''; | ||
| 125 | + if (mesg == '네') { | ||
| 126 | + mbti = 'N'; | ||
| 127 | + } else if (mesg == '아니오') { | ||
| 128 | + mbti = 'S'; | ||
| 129 | + } | ||
| 130 | + userDB[userId][1] += mbti; | ||
| 131 | + console.log(userDB[userId]); | ||
| 132 | + const responseBody = { | ||
| 133 | + version: "2.0", | ||
| 134 | + template: { | ||
| 135 | + outputs: [ | ||
| 136 | + { | ||
| 137 | + "simpleText": { | ||
| 138 | + "text": "토론 시 사람들의 민감한 반응보다 보다 진실을 더 중요시해야 합니다." | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + ], | ||
| 142 | + quickReplies: [ | ||
| 143 | + { | ||
| 144 | + action: "block", | ||
| 145 | + label: "네", | ||
| 146 | + message: "네", | ||
| 147 | + blockId: "6297b1275ceed96c38544a08" | ||
| 148 | + }, | ||
| 149 | + { | ||
| 150 | + action: "block", | ||
| 151 | + label: "아니오", | ||
| 152 | + message: "아니오", | ||
| 153 | + blockId: "6297b1275ceed96c38544a08" | ||
| 154 | + } | ||
| 155 | + ] | ||
| 156 | + } | ||
| 157 | + }; | ||
| 158 | + res.status(200).send(responseBody); | ||
| 159 | +}); | ||
| 79 | 160 | ||
| 80 | app.listen((process.env.PORT || 3000), function() { | 161 | app.listen((process.env.PORT || 3000), function() { |
| 81 | console.log('Example skill server listening on port 3000!'); | 162 | console.log('Example skill server listening on port 3000!'); | ... | ... |
-
Please register or login to post a comment