Showing
3 changed files
with
30 additions
and
30 deletions
... | @@ -20,7 +20,7 @@ const multiCheckMamul = (client) => { | ... | @@ -20,7 +20,7 @@ const multiCheckMamul = (client) => { |
20 | type: "text", | 20 | type: "text", |
21 | text: `유저님의 ${keywords[i]} 매물 알림이 도착했어요!`, | 21 | text: `유저님의 ${keywords[i]} 매물 알림이 도착했어요!`, |
22 | }, | 22 | }, |
23 | - setCarouselMessage(res), | 23 | + setCarouselMessage(res, keywords[i]), |
24 | ]); | 24 | ]); |
25 | }); | 25 | }); |
26 | }); | 26 | }); |
... | @@ -39,7 +39,7 @@ const checkMamul = (client, userId) => { | ... | @@ -39,7 +39,7 @@ const checkMamul = (client, userId) => { |
39 | type: "text", | 39 | type: "text", |
40 | text: `유저님의 ${keywords[i]} 매물 알림이 도착했어요!`, | 40 | text: `유저님의 ${keywords[i]} 매물 알림이 도착했어요!`, |
41 | }, | 41 | }, |
42 | - setCarouselMessage(res), | 42 | + setCarouselMessage(res, keywords[i]), |
43 | ] | 43 | ] |
44 | ); | 44 | ); |
45 | }); | 45 | }); | ... | ... |
1 | // Line chatbot + Message generate functions | 1 | // Line chatbot + Message generate functions |
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 | +// const setKeywordsFlexMessage = require("./message/setKeywordsFlexMessage"); |
6 | 6 | ||
7 | // Market Search | 7 | // Market Search |
8 | -const { daangnSingleSearch } = require("./search/daangnSearch"); | 8 | +// const { daangnSingleSearch } = require("./search/daangnSearch"); |
9 | -const { daangnMultiSearch } = require("./search/daangnSearch"); | 9 | +// const { daangnMultiSearch } = require("./search/daangnSearch"); |
10 | -const { joongnaSingleSearch } = require("./search/joongnaSearch"); | 10 | +// const { joongnaSingleSearch } = require("./search/joongnaSearch"); |
11 | -const { joongnaMultiSearch } = require("./search/joongnaSearch"); | 11 | +// const { joongnaMultiSearch } = require("./search/joongnaSearch"); |
12 | -const { bunjangSingleSearch } = require("./search/bunjangSearch"); | 12 | +// const { bunjangSingleSearch } = require("./search/bunjangSearch"); |
13 | -const { bunjangMultiSearch } = require("./search/bunjangSearch"); | 13 | +// const { bunjangMultiSearch } = require("./search/bunjangSearch"); |
14 | const { marketMultiSearch } = require("./search/marketSearch"); | 14 | const { marketMultiSearch } = require("./search/marketSearch"); |
15 | 15 | ||
16 | // File search - Will be deleted (Unused) | 16 | // File search - Will be deleted (Unused) |
... | @@ -105,7 +105,10 @@ function handleEvent(event) { | ... | @@ -105,7 +105,10 @@ function handleEvent(event) { |
105 | text: `매물이 등록되었습니다!\n등록된 매물: ${event.message.text}`, | 105 | text: `매물이 등록되었습니다!\n등록된 매물: ${event.message.text}`, |
106 | }), | 106 | }), |
107 | marketMultiSearch(event.message.text).then((res) => { | 107 | marketMultiSearch(event.message.text).then((res) => { |
108 | - client.pushMessage(event.source.userId, setCarouselMessage(res)); | 108 | + client.pushMessage( |
109 | + event.source.userId, | ||
110 | + setCarouselMessage(res, event.message.text) | ||
111 | + ); | ||
109 | }) | 112 | }) |
110 | ); | 113 | ); |
111 | } | 114 | } | ... | ... |
1 | const setFlexMessage = require("./setFlexMessage"); | 1 | const setFlexMessage = require("./setFlexMessage"); |
2 | 2 | ||
3 | -function setCarouselMessage(mamuls) { | 3 | +function setCarouselMessage(mamuls, keyword) { |
4 | let flexMessages = []; | 4 | let flexMessages = []; |
5 | let flexMessage = {}; | 5 | let flexMessage = {}; |
6 | if ( | 6 | if ( |
... | @@ -102,32 +102,29 @@ function setCarouselMessage(mamuls) { | ... | @@ -102,32 +102,29 @@ function setCarouselMessage(mamuls) { |
102 | mamuls[i]["itemUrl"], | 102 | mamuls[i]["itemUrl"], |
103 | mamuls[i]["extraInfo"] | 103 | mamuls[i]["extraInfo"] |
104 | ); | 104 | ); |
105 | - if (i == 0) { | ||
106 | - flexMessage["header"] = { | ||
107 | - type: "box", | ||
108 | - layout: "horizontal", | ||
109 | - contents: [ | ||
110 | - { type: "text", text: "매무리 봇", size: "sm", color: "#1DB446" }, | ||
111 | - { | ||
112 | - type: "text", | ||
113 | - text: `키워드: rtx3080`, | ||
114 | - align: "end", | ||
115 | - color: "#1DB446", | ||
116 | - weight: "bold", | ||
117 | - }, | ||
118 | - ], | ||
119 | - }; | ||
120 | - } | ||
121 | flexMessages.push(flexMessage); | 105 | flexMessages.push(flexMessage); |
122 | } catch (err) { | 106 | } catch (err) { |
123 | console.log(err); | 107 | console.log(err); |
124 | continue; | 108 | continue; |
125 | } | 109 | } |
126 | } | 110 | } |
127 | - | 111 | + flexMessages[0]["header"] = { |
112 | + type: "box", | ||
113 | + layout: "horizontal", | ||
114 | + contents: [ | ||
115 | + { type: "text", text: "매무리 봇", size: "sm", color: "#1DB446" }, | ||
116 | + { | ||
117 | + type: "text", | ||
118 | + text: `키워드: ${keyword}`, | ||
119 | + align: "end", | ||
120 | + color: "#1DB446", | ||
121 | + weight: "bold", | ||
122 | + }, | ||
123 | + ], | ||
124 | + }; | ||
128 | let carouselMessage = { | 125 | let carouselMessage = { |
129 | type: "flex", | 126 | type: "flex", |
130 | - altText: "Carousel mamul message", | 127 | + altText: `유저님의 ${keyword}매물 알림!`, |
131 | contents: { | 128 | contents: { |
132 | type: "carousel", | 129 | type: "carousel", |
133 | contents: flexMessages, | 130 | contents: flexMessages, | ... | ... |
-
Please register or login to post a comment