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-30 21:38:34 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9c0e28cf9d963a551f3226e557285f0bf99e45a2
9c0e28cf
1 parent
af148030
EDIT: 12 mamuls in one Carousel
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
13 deletions
server/chatbot/check/checkMamul.js
server/chatbot/message/setCarouselMessage.js
server/chatbot/search/marketSearch.js
server/chatbot/check/checkMamul.js
View file @
9c0e28c
...
...
@@ -26,7 +26,7 @@ const checkMamul = (client, userId) => {
db
.
getKeywordsByUserId
(
userId
).
then
((
keywords
)
=>
{
for
(
let
i
=
0
,
pending
=
Promise
.
resolve
();
i
<
keywords
.
length
;
i
++
)
{
pending
=
marketMultiSearch
(
keywords
[
i
]).
then
((
res
)
=>
{
client
.
multicast
([
userId
],
[
setCarouselMessage
(
res
,
keywords
[
i
])]
);
client
.
pushMessage
(
userId
,
setCarouselMessage
(
res
,
keywords
[
i
])
);
});
}
});
...
...
server/chatbot/message/setCarouselMessage.js
View file @
9c0e28c
...
...
@@ -4,9 +4,19 @@ function setCarouselMessage(mamuls, keyword) {
let
flexMessages
=
[];
let
flexMessage
=
{};
if
(
mamuls
[
0
]
==
undefined
&&
mamuls
[
1
]
==
undefined
&&
mamuls
[
2
]
==
undefined
mamuls
[
0
]
==
undefined
// &&
// mamuls[1] == undefined &&
// mamuls[2] == undefined &&
// mamuls[3] == undefined &&
// mamuls[4] == undefined &&
// mamuls[5] == undefined &&
// mamuls[6] == undefined &&
// mamuls[7] == undefined &&
// mamuls[8] == undefined &&
// mamuls[9] == undefined &&
// mamuls[10] == undefined &&
// mamuls[11] == undefined
)
{
let
nonMamulMessage
=
{
type
:
"flex"
,
...
...
server/chatbot/search/marketSearch.js
View file @
9c0e28c
const
{
daangn
Single
Search
}
=
require
(
"./daangnSearch"
);
const
{
bunjang
Single
Search
}
=
require
(
"./bunjangSearch"
);
const
{
joongna
Single
Search
}
=
require
(
"./joongnaSearch"
);
const
{
daangn
Multi
Search
}
=
require
(
"./daangnSearch"
);
const
{
bunjang
Multi
Search
}
=
require
(
"./bunjangSearch"
);
const
{
joongna
Multi
Search
}
=
require
(
"./joongnaSearch"
);
const
setCarouselMessage
=
require
(
"../message/setCarouselMessage"
);
const
marketMultiSearch
=
(
keyword
)
=>
{
const
result
=
[];
return
new
Promise
((
resolve
,
reject
)
=>
{
daangnSingleSearch
(
keyword
).
then
((
res
)
=>
{
result
.
push
(
res
);
bunjangSingleSearch
(
keyword
).
then
((
res
)
=>
{
result
.
push
(
res
);
joongnaSingleSearch
(
keyword
).
then
((
res
)
=>
{
result
.
push
(
res
);
daangnMultiSearch
(
keyword
).
then
((
res
)
=>
{
if
(
res
!==
undefined
)
{
for
(
let
i
=
0
;
i
<
res
.
length
&&
i
<
4
;
i
++
)
{
result
.
push
(
res
[
i
]);
}
}
bunjangMultiSearch
(
keyword
).
then
((
res
)
=>
{
if
(
res
!==
undefined
)
{
for
(
let
i
=
0
;
i
<
res
.
length
&&
i
<
4
;
i
++
)
{
result
.
push
(
res
[
i
]);
}
}
joongnaMultiSearch
(
keyword
).
then
((
res
)
=>
{
if
(
res
!==
undefined
)
{
for
(
let
i
=
0
;
i
<
res
.
length
&&
i
<
4
;
i
++
)
{
result
.
push
(
res
[
i
]);
}
}
resolve
(
result
);
});
});
...
...
Please
register
or
login
to post a comment