setKeywordsFlexMessage.js
1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function setKeywordsFlexMessage(keywords) {
let flexMessage = {
type: "bubble",
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",
},
],
},
};
for (let i = 0; i < keywords.length; i++) {
const textbox = createKeywordTextBox(keywords[i]);
flexMessage.body.contents[3].contents.push(textbox);
}
return {
type: "flex",
altText: "매무리 키워드 확인",
contents: flexMessage,
};
}
function createKeywordTextBox(keyword) {
return {
type: "text",
text: keyword,
size: "lg",
align: "center",
margin: "md",
};
}
module.exports = setKeywordsFlexMessage;