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:27:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5cd3bd72860bc730af3cf0c075c8cde9563c1c96
5cd3bd72
1 parent
2d3cdf79
ADD: function for create flexMessage with user's keywords
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
server/chatbot/index.js
server/chatbot/message/setKeywordsFlexMessage.js
server/chatbot/index.js
View file @
5cd3bd7
...
...
@@ -2,6 +2,7 @@
const
line
=
require
(
"@line/bot-sdk"
);
const
setFlexMessage
=
require
(
"./message/setFlexMessage"
);
const
setCarouselMessage
=
require
(
"./message/setCarouselMessage"
);
const
setKeywordsFlexMessage
=
require
(
"./message/setKeywordsFlexMessage"
)
// Market Search
const
{
daangnSingleSearch
}
=
require
(
"./search/daangnSearch"
);
...
...
server/chatbot/message/setKeywordsFlexMessage.js
0 → 100644
View file @
5cd3bd7
function
setKeywordsFlexMessage
(
keywords
)
{
let
flexMessage
=
{
type
:
"bubble"
,
hero
:
{},
body
:
{
type
:
"box"
,
layout
:
"vertical"
,
contents
:
[
{
type
:
"text"
,
text
:
"매무리 봇"
,
weight
:
"bold"
,
color
:
"#1DB446"
,
size
:
"sm"
,
},
{
type
:
"text"
,
text
:
"등록된 키워드"
,
weight
:
"bold"
,
size
:
"xxl"
,
margin
:
"md"
},
{
type
:
"separator"
,
margin
:
"xxl"
},
{
type
:
"box"
,
layout
:
"vertical"
,
contents
:
[],
margin
:
"md"
}
]
},
styles
:
{
footer
:
{
separator
:
"true"
}
}
};
for
(
let
i
=
0
;
i
<
keywords
.
length
;
i
++
)
{
const
textbox
=
createKeywordTextBox
(
keywords
[
i
]);
flexMessage
.
body
.
contents
[
3
].
contents
.
push
(
textbox
);
}
return
flexMessage
}
function
createKeywordTextBox
(
keyword
)
{
return
{
type
:
"text"
,
text
:
keyword
,
size
:
"lg"
,
align
:
"center"
,
margin
:
"md"
}
}
module
.
exports
=
setKeywordsFlexMessage
;
\ No newline at end of file
Please
register
or
login
to post a comment