Toggle navigation
Toggle navigation
This project
Loading...
Sign in
윤준석
/
mamuri-bot
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
윤준석
2022-05-27 22:44:43 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
64b7753bf725929f442494b7e2feec8174f3c614
64b7753b
1 parent
5cd3bd72
ADD: checkKeywords and reply flexMessage to LINE Client
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
server/chatbot/check/checkKeywords.js
server/chatbot/checkMamul/checkMamul.js → server/chatbot/check/checkMamul.js
server/chatbot/index.js
server/chatbot/message/setKeywordsFlexMessage.js
server/chatbot/check/checkKeywords.js
0 → 100644
View file @
64b7753
const
setKeywordsFlexMessage
=
require
(
"../message/setKeywordsFlexMessage"
)
const
db
=
require
(
"../../apis/database"
);
const
checkKeywords
=
(
client
,
event
)
=>
{
db
.
getKeywordsByUserId
(
event
.
source
.
userId
).
then
((
keywords
)
=>
{
flexMessage
=
setKeywordsFlexMessage
(
keywords
);
client
.
replyMessage
(
event
.
replyToken
,
flexMessage
)
})
};
module
.
exports
=
{
checkKeywords
};
\ No newline at end of file
server/chatbot/check
Mamul
/checkMamul.js
→
server/chatbot/check/checkMamul.js
View file @
64b7753
File moved
server/chatbot/index.js
View file @
64b7753
...
...
@@ -40,7 +40,8 @@ const config = {
};
// Cron for Mamul Notification
const
{
multiCheckMamul
,
checkMamul
}
=
require
(
"./checkMamul/checkMamul"
);
const
{
multiCheckMamul
,
checkMamul
}
=
require
(
"./check/checkMamul"
);
const
{
checkKeywords
}
=
require
(
"./check/checkKeywords"
)
// Line chat bot client & event
...
...
@@ -90,7 +91,7 @@ function handleEvent(event) {
}
}
else
if
(
event
.
postback
.
data
==
"checkKeywords"
)
{
return
Promise
.
resolve
(
c
onsole
.
log
(
"키워드 확인"
)
c
heckKeywords
(
client
,
event
)
)
}
}
...
...
server/chatbot/message/setKeywordsFlexMessage.js
View file @
64b7753
function
setKeywordsFlexMessage
(
keywords
)
{
let
flexMessage
=
{
type
:
"bubble"
,
hero
:
{},
body
:
{
type
:
"box"
,
layout
:
"vertical"
,
...
...
@@ -32,11 +31,6 @@ function setKeywordsFlexMessage(keywords) {
}
]
},
styles
:
{
footer
:
{
separator
:
"true"
}
}
};
for
(
let
i
=
0
;
i
<
keywords
.
length
;
i
++
)
{
...
...
@@ -44,7 +38,11 @@ function setKeywordsFlexMessage(keywords) {
flexMessage
.
body
.
contents
[
3
].
contents
.
push
(
textbox
);
}
return
flexMessage
return
{
type
:
"flex"
,
altText
:
"키워드 조회 오류"
,
contents
:
flexMessage
}
}
function
createKeywordTextBox
(
keyword
)
{
...
...
Please
register
or
login
to post a comment