Showing
1 changed file
with
24 additions
and
0 deletions
... | @@ -56,6 +56,11 @@ function onMessage(message, replyToken) { | ... | @@ -56,6 +56,11 @@ function onMessage(message, replyToken) { |
56 | return; | 56 | return; |
57 | } | 57 | } |
58 | 58 | ||
59 | + if(message.text.indexOf('확률') >= 0) { | ||
60 | + sendProbabilities(replyToken); | ||
61 | + return; | ||
62 | + } | ||
63 | + | ||
59 | replyMessage(replyToken, [{type: 'text', text: '수행할 수 없는 명령입니다.'}]); | 64 | replyMessage(replyToken, [{type: 'text', text: '수행할 수 없는 명령입니다.'}]); |
60 | } | 65 | } |
61 | 66 | ||
... | @@ -193,6 +198,25 @@ async function recommendMeta(replyToken) { | ... | @@ -193,6 +198,25 @@ async function recommendMeta(replyToken) { |
193 | replyMessage(replyToken, messages); | 198 | replyMessage(replyToken, messages); |
194 | } | 199 | } |
195 | 200 | ||
201 | +function sendProbabilities(replyToken) { | ||
202 | + let probs = [ | ||
203 | + [100, 0, 0, 0, 0], | ||
204 | + [100, 0, 0, 0, 0], | ||
205 | + [75, 25, 0, 0, 0], | ||
206 | + [55, 30, 15, 0, 0], | ||
207 | + [45, 33, 20, 2, 0], | ||
208 | + [35, 35, 25, 5, 0], | ||
209 | + [22, 35, 30, 12, 1], | ||
210 | + [15, 25, 35, 20, 5], | ||
211 | + [10, 15, 30, 30, 15] | ||
212 | + ]; | ||
213 | + | ||
214 | + replyMessage(replyToken, [{ | ||
215 | + type: 'text', | ||
216 | + text: probs.map((arr, idx) => `Lv.${idx + 1}: ${arr.map(e => `${e}%`).join(' ')}`).join('\n') | ||
217 | + }]) | ||
218 | +} | ||
219 | + | ||
196 | function replyMessage(replyToken, messages) { | 220 | function replyMessage(replyToken, messages) { |
197 | axios.post('https://api.line.me/v2/bot/message/reply', { | 221 | axios.post('https://api.line.me/v2/bot/message/reply', { |
198 | replyToken: replyToken, | 222 | replyToken: replyToken, | ... | ... |
-
Please register or login to post a comment