윤준석

ADD: function for create flexMessage with user's keywords

......@@ -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");
......
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