유명현

EDIT: Display mamul keyword at first flexMessage

......@@ -20,7 +20,7 @@ const multiCheckMamul = (client) => {
type: "text",
text: `유저님의 ${keywords[i]} 매물 알림이 도착했어요!`,
},
setCarouselMessage(res),
setCarouselMessage(res, keywords[i]),
]);
});
});
......@@ -39,7 +39,7 @@ const checkMamul = (client, userId) => {
type: "text",
text: `유저님의 ${keywords[i]} 매물 알림이 도착했어요!`,
},
setCarouselMessage(res),
setCarouselMessage(res, keywords[i]),
]
);
});
......
// Line chatbot + Message generate functions
const line = require("@line/bot-sdk");
const setFlexMessage = require("./message/setFlexMessage");
// const setFlexMessage = require("./message/setFlexMessage");
const setCarouselMessage = require("./message/setCarouselMessage");
const setKeywordsFlexMessage = require("./message/setKeywordsFlexMessage");
// const setKeywordsFlexMessage = require("./message/setKeywordsFlexMessage");
// Market Search
const { daangnSingleSearch } = require("./search/daangnSearch");
const { daangnMultiSearch } = require("./search/daangnSearch");
const { joongnaSingleSearch } = require("./search/joongnaSearch");
const { joongnaMultiSearch } = require("./search/joongnaSearch");
const { bunjangSingleSearch } = require("./search/bunjangSearch");
const { bunjangMultiSearch } = require("./search/bunjangSearch");
// const { daangnSingleSearch } = require("./search/daangnSearch");
// const { daangnMultiSearch } = require("./search/daangnSearch");
// const { joongnaSingleSearch } = require("./search/joongnaSearch");
// const { joongnaMultiSearch } = require("./search/joongnaSearch");
// const { bunjangSingleSearch } = require("./search/bunjangSearch");
// const { bunjangMultiSearch } = require("./search/bunjangSearch");
const { marketMultiSearch } = require("./search/marketSearch");
// File search - Will be deleted (Unused)
......@@ -105,7 +105,10 @@ function handleEvent(event) {
text: `매물이 등록되었습니다!\n등록된 매물: ${event.message.text}`,
}),
marketMultiSearch(event.message.text).then((res) => {
client.pushMessage(event.source.userId, setCarouselMessage(res));
client.pushMessage(
event.source.userId,
setCarouselMessage(res, event.message.text)
);
})
);
}
......
const setFlexMessage = require("./setFlexMessage");
function setCarouselMessage(mamuls) {
function setCarouselMessage(mamuls, keyword) {
let flexMessages = [];
let flexMessage = {};
if (
......@@ -102,32 +102,29 @@ function setCarouselMessage(mamuls) {
mamuls[i]["itemUrl"],
mamuls[i]["extraInfo"]
);
if (i == 0) {
flexMessage["header"] = {
type: "box",
layout: "horizontal",
contents: [
{ type: "text", text: "매무리 봇", size: "sm", color: "#1DB446" },
{
type: "text",
text: `키워드: rtx3080`,
align: "end",
color: "#1DB446",
weight: "bold",
},
],
};
}
flexMessages.push(flexMessage);
} catch (err) {
console.log(err);
continue;
}
}
flexMessages[0]["header"] = {
type: "box",
layout: "horizontal",
contents: [
{ type: "text", text: "매무리 봇", size: "sm", color: "#1DB446" },
{
type: "text",
text: `키워드: ${keyword}`,
align: "end",
color: "#1DB446",
weight: "bold",
},
],
};
let carouselMessage = {
type: "flex",
altText: "Carousel mamul message",
altText: `유저님의 ${keyword}매물 알림!`,
contents: {
type: "carousel",
contents: flexMessages,
......