김성욱

Add question1

Showing 1 changed file with 4 additions and 159 deletions
...@@ -45,7 +45,7 @@ apiRouter.post('/question1', (req, res) => { ...@@ -45,7 +45,7 @@ apiRouter.post('/question1', (req, res) => {
45 var userId = req.body.userRequest.user.id; 45 var userId = req.body.userRequest.user.id;
46 var mesg = req.body.userRequest; 46 var mesg = req.body.userRequest;
47 console.log('[q1:user message] ', mesg); 47 console.log('[q1:user message] ', mesg);
48 - userDB[userId] = ''; 48 + userDB[userId] = ['','','','',''];
49 console.log(userDB[userId]); 49 console.log(userDB[userId]);
50 const responseBody = { 50 const responseBody = {
51 version: "2.0", 51 version: "2.0",
...@@ -53,7 +53,7 @@ apiRouter.post('/question1', (req, res) => { ...@@ -53,7 +53,7 @@ apiRouter.post('/question1', (req, res) => {
53 outputs: [ 53 outputs: [
54 { 54 {
55 simpleText: { 55 simpleText: {
56 - text: '사람들과 어울리는 것을 좋아하시나요?' 56 + text: '금방 새로운 직장 사람들과 어울리기 시작합니다.'
57 } 57 }
58 } 58 }
59 ], 59 ],
...@@ -62,13 +62,13 @@ apiRouter.post('/question1', (req, res) => { ...@@ -62,13 +62,13 @@ apiRouter.post('/question1', (req, res) => {
62 action: "block", 62 action: "block",
63 label: "네", 63 label: "네",
64 message: "네", 64 message: "네",
65 - blockId: "628e8cb07bd2fd433357f878" 65 + blockId: "6297b11ae7a0253c7662ccea"
66 }, 66 },
67 { 67 {
68 action: "block", 68 action: "block",
69 label: "아니오", 69 label: "아니오",
70 message: "아니오", 70 message: "아니오",
71 - blockId: "628e8cb07bd2fd433357f878" 71 + blockId: "6297b11ae7a0253c7662ccea"
72 } 72 }
73 ] 73 ]
74 } 74 }
...@@ -76,161 +76,6 @@ apiRouter.post('/question1', (req, res) => { ...@@ -76,161 +76,6 @@ 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] += 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: "628d239d93b31d5b60ab6c29"
107 - },
108 - {
109 - action: "block",
110 - label: "아니오",
111 - message: "아니오",
112 - blockId: "628d239d93b31d5b60ab6c29"
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] += mbti;
131 - console.log(userDB[userId]);
132 - const responseBody = {
133 - version: "2.0",
134 - template: {
135 - outputs: [
136 - {
137 - "simpleText": {
138 - "text": "다음과 같은 상황에서 어떻게 대답하겠습니까?\n 친구: 나 기분 안 좋아서 옷 샀어"
139 - }
140 - }
141 - ],
142 - quickReplies: [
143 - {
144 - action: "block",
145 - label: "왜 기분 안 좋아?",
146 - message: "왜 기분 안 좋아?",
147 - blockId: "6290630451c40d32c6d8e71f"
148 - },
149 - {
150 - action: "block",
151 - label: "무슨 옷 샀어?",
152 - message: "무슨 옷 샀어?",
153 - blockId: "6290630451c40d32c6d8e71f"
154 - }
155 - ]
156 - }
157 - };
158 - res.status(200).send(responseBody);
159 -});
160 -
161 -apiRouter.post('/question4', (req, res) => {
162 - var userId = req.body.userRequest.user.id;
163 - var mesg = req.body.userRequest.utterance;
164 - console.log('[q4:user message] ', mesg);
165 - var mbti = '';
166 - if (mesg == "왜 기분 안 좋아?") {
167 - mbti = 'F';
168 - } else if (mesg == "무슨 옷 샀어?") {
169 - mbti = 'T';
170 - }
171 - userDB[userId] += mbti;
172 - console.log(userDB[userId]);
173 - const responseBody = {
174 - version: "2.0",
175 - template: {
176 - outputs: [
177 - {
178 - simpleText: {
179 - text: "그날 할 일에 대해 계획을 미리 세우시나요?"
180 - }
181 - }
182 - ],
183 - quickReplies: [
184 - {
185 - action: "block",
186 - label: "네",
187 - message: "네",
188 - blockId: "6293885b7bd2fd4333583df0"
189 - },
190 - {
191 - action: "block",
192 - label: "아니오",
193 - message: "아니오",
194 - blockId: "6293885b7bd2fd4333583df0"
195 - }
196 - ]
197 - }
198 - }
199 - res.status(200).send(responseBody);
200 -});
201 -
202 -apiRouter.post('/result', (req, res) => {
203 - var userId = req.body.userRequest.user.id;
204 - var mesg = req.body.userRequest.utterance;
205 - console.log('[result:user message] ', mesg);
206 - var mbti = '';
207 - if (mesg == "네") {
208 - mbti = 'J';
209 - } else if (mesg == "아니오") {
210 - mbti = 'P';
211 - }
212 - userDB[userId] += mbti;
213 - console.log(userDB[userId]);
214 - const responseBody = {
215 - version: "2.0",
216 - template: {
217 - outputs: [
218 - {
219 - simpleText: {
220 - text: "당신의 MBTI는 : "+userDB[userId]
221 - }
222 - }
223 - ],
224 - quickReplies: [{
225 - action: "block",
226 - label: "MBTI 테스트 다시하기",
227 - message: "MBTI 테스트 다시하기",
228 - blockId : "628b8005055a574d7df54466"
229 - }]
230 - }
231 - }
232 - res.status(200).send(responseBody);
233 -});
234 79
235 app.listen((process.env.PORT || 3000), function() { 80 app.listen((process.env.PORT || 3000), function() {
236 console.log('Example skill server listening on port 3000!'); 81 console.log('Example skill server listening on port 3000!');
......