윤준석

ADD: checkKeywords and reply flexMessage to LINE Client

const setKeywordsFlexMessage = require("../message/setKeywordsFlexMessage")
const db = require("../../apis/database");
const checkKeywords = (client, event) => {
db.getKeywordsByUserId(event.source.userId).then((keywords) => {
flexMessage = setKeywordsFlexMessage(keywords);
client.replyMessage(event.replyToken, flexMessage)
})
};
module.exports = { checkKeywords };
\ No newline at end of file
......@@ -40,7 +40,8 @@ const config = {
};
// Cron for Mamul Notification
const { multiCheckMamul, checkMamul } = require("./checkMamul/checkMamul");
const { multiCheckMamul, checkMamul } = require("./check/checkMamul");
const { checkKeywords } = require("./check/checkKeywords")
// Line chat bot client & event
......@@ -90,7 +91,7 @@ function handleEvent(event) {
}
} else if (event.postback.data == "checkKeywords") {
return Promise.resolve(
console.log("키워드 확인")
checkKeywords(client, event)
)
}
}
......
function setKeywordsFlexMessage(keywords) {
let flexMessage = {
type: "bubble",
hero: {},
body: {
type: "box",
layout: "vertical",
......@@ -32,11 +31,6 @@ function setKeywordsFlexMessage(keywords) {
}
]
},
styles: {
footer: {
separator: "true"
}
}
};
for (let i = 0; i < keywords.length; i++) {
......@@ -44,7 +38,11 @@ function setKeywordsFlexMessage(keywords) {
flexMessage.body.contents[3].contents.push(textbox);
}
return flexMessage
return {
type: "flex",
altText: "키워드 조회 오류",
contents: flexMessage
}
}
function createKeywordTextBox(keyword) {
......