Toggle navigation
Toggle navigation
This project
Loading...
Sign in
마수현
/
tft-chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
유재형
2020-12-08 17:22:32 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
Ma Suhyeon
2020-12-08 17:22:32 +0900
Commit
81f16d398036e45292bb74ef45ce8d0c5b6af924
81f16d39
1 parent
4982f094
implement probabilities message
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
app.js
app.js
View file @
81f16d3
...
...
@@ -56,6 +56,11 @@ function onMessage(message, replyToken) {
return
;
}
if
(
message
.
text
.
indexOf
(
'확률'
)
>=
0
)
{
sendProbabilities
(
replyToken
);
return
;
}
replyMessage
(
replyToken
,
[{
type
:
'text'
,
text
:
'수행할 수 없는 명령입니다.'
}]);
}
...
...
@@ -193,6 +198,25 @@ async function recommendMeta(replyToken) {
replyMessage
(
replyToken
,
messages
);
}
function
sendProbabilities
(
replyToken
)
{
let
probs
=
[
[
100
,
0
,
0
,
0
,
0
],
[
100
,
0
,
0
,
0
,
0
],
[
75
,
25
,
0
,
0
,
0
],
[
55
,
30
,
15
,
0
,
0
],
[
45
,
33
,
20
,
2
,
0
],
[
35
,
35
,
25
,
5
,
0
],
[
22
,
35
,
30
,
12
,
1
],
[
15
,
25
,
35
,
20
,
5
],
[
10
,
15
,
30
,
30
,
15
]
];
replyMessage
(
replyToken
,
[{
type
:
'text'
,
text
:
probs
.
map
((
arr
,
idx
)
=>
`Lv.
${
idx
+
1
}
:
${
arr
.
map
(
e
=>
`
${
e
}
%`
).
join
(
' '
)}
`
).
join
(
'\n'
)
}])
}
function
replyMessage
(
replyToken
,
messages
)
{
axios
.
post
(
'https://api.line.me/v2/bot/message/reply'
,
{
replyToken
:
replyToken
,
...
...
Please
register
or
login
to post a comment