Toggle navigation
Toggle navigation
This project
Loading...
Sign in
방승일
/
mamuri-bot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
유명현
2022-05-28 23:35:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ad0454b1b3a6fd71e7f189af549de2415dae593e
ad0454b1
1 parent
3720f2b3
EDIT: checkKeywords after deleteKeyword
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
server/chatbot/index.js
server/chatbot/index.js
View file @
ad0454b
...
...
@@ -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
);
})
);
}
}
}
...
...
Please
register
or
login
to post a comment