유명현

EDIT: checkKeywords after deleteKeyword

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
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");
...@@ -41,8 +41,7 @@ const config = { ...@@ -41,8 +41,7 @@ const config = {
41 41
42 // Cron for Mamul Notification 42 // Cron for Mamul Notification
43 const { multiCheckMamul, checkMamul } = require("./check/checkMamul"); 43 const { multiCheckMamul, checkMamul } = require("./check/checkMamul");
44 -const { checkKeywords } = require("./check/checkKeywords") 44 +const { checkKeywords } = require("./check/checkKeywords");
45 -
46 45
47 // Line chat bot client & event 46 // Line chat bot client & event
48 const client = new line.Client(config); 47 const client = new line.Client(config);
...@@ -74,9 +73,7 @@ function handleEvent(event) { ...@@ -74,9 +73,7 @@ function handleEvent(event) {
74 ); 73 );
75 } 74 }
76 } else if (event.postback.data == "checkItems") { 75 } else if (event.postback.data == "checkItems") {
77 - return Promise.resolve( 76 + return Promise.resolve(checkMamul(client, event.source.userId));
78 - checkMamul(client, event.source.userId),
79 - );
80 } else if (event.postback.data == "deleteKeyword") { 77 } else if (event.postback.data == "deleteKeyword") {
81 var foundDelete = waitDeleteMamulList.indexOf(event.source.userId); 78 var foundDelete = waitDeleteMamulList.indexOf(event.source.userId);
82 if (foundDelete == -1) { 79 if (foundDelete == -1) {
...@@ -90,9 +87,7 @@ function handleEvent(event) { ...@@ -90,9 +87,7 @@ function handleEvent(event) {
90 ); 87 );
91 } 88 }
92 } else if (event.postback.data == "checkKeywords") { 89 } else if (event.postback.data == "checkKeywords") {
93 - return Promise.resolve( 90 + return Promise.resolve(checkKeywords(client, event));
94 - checkKeywords(client, event)
95 - )
96 } 91 }
97 } 92 }
98 return Promise.resolve(null); 93 return Promise.resolve(null);
...@@ -121,11 +116,15 @@ function handleEvent(event) { ...@@ -121,11 +116,15 @@ function handleEvent(event) {
121 console.log(waitDeleteMamulList[foundDelete]); 116 console.log(waitDeleteMamulList[foundDelete]);
122 return Promise.resolve( 117 return Promise.resolve(
123 db.deleteKeyword(event.source.userId, event.message.text), 118 db.deleteKeyword(event.source.userId, event.message.text),
124 - client.replyMessage(event.replyToken, { 119 + client
120 + .replyMessage(event.replyToken, {
125 type: "text", 121 type: "text",
126 text: `매물이 삭제되었습니다!\n삭제된 매물: ${event.message.text}`, 122 text: `매물이 삭제되었습니다!\n삭제된 매물: ${event.message.text}`,
127 }) 123 })
128 - ) 124 + .then(() => {
125 + checkKeywords(client, event);
126 + })
127 + );
129 } 128 }
130 } 129 }
131 } 130 }
......