유명현

EDIT: Include keyword info in flex message

...@@ -71,11 +71,12 @@ function setCarouselMessage(mamuls) { ...@@ -71,11 +71,12 @@ function setCarouselMessage(mamuls) {
71 pos = foundPos + 1; 71 pos = foundPos + 1;
72 } 72 }
73 console.log(`pos: ${pos}`); 73 console.log(`pos: ${pos}`);
74 - if (foundPos !== 1) { 74 + if (foundPos !== -1) {
75 mamuls[i]["extraInfo"] = 75 mamuls[i]["extraInfo"] =
76 mamuls[i]["extraInfo"].slice(0, foundPos) + "\n..."; 76 mamuls[i]["extraInfo"].slice(0, foundPos) + "\n...";
77 console.log(`parsed extraInfo : \n${mamuls[i]["extraInfo"]}`); 77 console.log(`parsed extraInfo : \n${mamuls[i]["extraInfo"]}`);
78 - } else if (mamuls[i]["extraInfo"].length > 40) { 78 + }
79 + if (mamuls[i]["extraInfo"].length > 40) {
79 mamuls[i]["extraInfo"] = 80 mamuls[i]["extraInfo"] =
80 mamuls[i]["extraInfo"].slice(0, 40) + "\n..."; 81 mamuls[i]["extraInfo"].slice(0, 40) + "\n...";
81 console.log(`parsed extraInfo : \n${mamuls[i]["extraInfo"]}`); 82 console.log(`parsed extraInfo : \n${mamuls[i]["extraInfo"]}`);
...@@ -101,6 +102,22 @@ function setCarouselMessage(mamuls) { ...@@ -101,6 +102,22 @@ function setCarouselMessage(mamuls) {
101 mamuls[i]["itemUrl"], 102 mamuls[i]["itemUrl"],
102 mamuls[i]["extraInfo"] 103 mamuls[i]["extraInfo"]
103 ); 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 + }
104 flexMessages.push(flexMessage); 121 flexMessages.push(flexMessage);
105 } catch (err) { 122 } catch (err) {
106 console.log(err); 123 console.log(err);
......