Showing
2 changed files
with
61 additions
and
0 deletions
... | @@ -2,6 +2,7 @@ | ... | @@ -2,6 +2,7 @@ |
2 | const line = require("@line/bot-sdk"); | 2 | const line = require("@line/bot-sdk"); |
3 | const setFlexMessage = require("./message/setFlexMessage"); | 3 | const setFlexMessage = require("./message/setFlexMessage"); |
4 | const setCarouselMessage = require("./message/setCarouselMessage"); | 4 | const setCarouselMessage = require("./message/setCarouselMessage"); |
5 | +const setKeywordsFlexMessage = require("./message/setKeywordsFlexMessage") | ||
5 | 6 | ||
6 | // Market Search | 7 | // Market Search |
7 | const { daangnSingleSearch } = require("./search/daangnSearch"); | 8 | const { daangnSingleSearch } = require("./search/daangnSearch"); | ... | ... |
1 | +function setKeywordsFlexMessage(keywords) { | ||
2 | + let flexMessage = { | ||
3 | + type: "bubble", | ||
4 | + hero: {}, | ||
5 | + body: { | ||
6 | + type: "box", | ||
7 | + layout: "vertical", | ||
8 | + contents: [ | ||
9 | + { | ||
10 | + type: "text", | ||
11 | + text: "매무리 봇", | ||
12 | + weight: "bold", | ||
13 | + color: "#1DB446", | ||
14 | + size: "sm", | ||
15 | + }, | ||
16 | + { | ||
17 | + type: "text", | ||
18 | + text: "등록된 키워드", | ||
19 | + weight: "bold", | ||
20 | + size: "xxl", | ||
21 | + margin: "md" | ||
22 | + }, | ||
23 | + { | ||
24 | + type: "separator", | ||
25 | + margin: "xxl" | ||
26 | + }, | ||
27 | + { | ||
28 | + type: "box", | ||
29 | + layout: "vertical", | ||
30 | + contents: [], | ||
31 | + margin: "md" | ||
32 | + } | ||
33 | + ] | ||
34 | + }, | ||
35 | + styles: { | ||
36 | + footer: { | ||
37 | + separator: "true" | ||
38 | + } | ||
39 | + } | ||
40 | + }; | ||
41 | + | ||
42 | + for (let i = 0; i < keywords.length; i++) { | ||
43 | + const textbox = createKeywordTextBox(keywords[i]); | ||
44 | + flexMessage.body.contents[3].contents.push(textbox); | ||
45 | + } | ||
46 | + | ||
47 | + return flexMessage | ||
48 | +} | ||
49 | + | ||
50 | +function createKeywordTextBox(keyword) { | ||
51 | + return { | ||
52 | + type: "text", | ||
53 | + text: keyword, | ||
54 | + size: "lg", | ||
55 | + align: "center", | ||
56 | + margin: "md" | ||
57 | + } | ||
58 | +} | ||
59 | + | ||
60 | +module.exports = setKeywordsFlexMessage; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment