유명현

EDIT: checkKeywords after deleteKeyword

......@@ -2,7 +2,7 @@
const line = require("@line/bot-sdk");
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");
......@@ -41,8 +41,7 @@ const config = {
// Cron for Mamul Notification
const { multiCheckMamul, checkMamul } = require("./check/checkMamul");
const { checkKeywords } = require("./check/checkKeywords")
const { checkKeywords } = require("./check/checkKeywords");
// Line chat bot client & event
const client = new line.Client(config);
......@@ -74,9 +73,7 @@ function handleEvent(event) {
);
}
} else if (event.postback.data == "checkItems") {
return Promise.resolve(
checkMamul(client, event.source.userId),
);
return Promise.resolve(checkMamul(client, event.source.userId));
} else if (event.postback.data == "deleteKeyword") {
var foundDelete = waitDeleteMamulList.indexOf(event.source.userId);
if (foundDelete == -1) {
......@@ -90,9 +87,7 @@ function handleEvent(event) {
);
}
} else if (event.postback.data == "checkKeywords") {
return Promise.resolve(
checkKeywords(client, event)
)
return Promise.resolve(checkKeywords(client, event));
}
}
return Promise.resolve(null);
......@@ -121,11 +116,15 @@ function handleEvent(event) {
console.log(waitDeleteMamulList[foundDelete]);
return Promise.resolve(
db.deleteKeyword(event.source.userId, event.message.text),
client.replyMessage(event.replyToken, {
client
.replyMessage(event.replyToken, {
type: "text",
text: `매물이 삭제되었습니다!\n삭제된 매물: ${event.message.text}`,
})
)
.then(() => {
checkKeywords(client, event);
})
);
}
}
}
......