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 17:37:13 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
64efbe3d8664ac3b4a78003d751e2b1093c05d81
64efbe3d
1 parent
0a2481e5
EDIT: Display mamul keyword at first flexMessage
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
server/chatbot/check/checkMamul.js
server/chatbot/index.js
server/chatbot/message/setCarouselMessage.js
server/chatbot/check/checkMamul.js
View file @
64efbe3
...
...
@@ -20,7 +20,7 @@ const multiCheckMamul = (client) => {
type
:
"text"
,
text
:
`유저님의
${
keywords
[
i
]}
매물 알림이 도착했어요!`
,
},
setCarouselMessage
(
res
),
setCarouselMessage
(
res
,
keywords
[
i
]
),
]);
});
});
...
...
@@ -39,7 +39,7 @@ const checkMamul = (client, userId) => {
type
:
"text"
,
text
:
`유저님의
${
keywords
[
i
]}
매물 알림이 도착했어요!`
,
},
setCarouselMessage
(
res
),
setCarouselMessage
(
res
,
keywords
[
i
]
),
]
);
});
...
...
server/chatbot/index.js
View file @
64efbe3
// Line chatbot + Message generate functions
const
line
=
require
(
"@line/bot-sdk"
);
const
setFlexMessage
=
require
(
"./message/setFlexMessage"
);
//
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"
);
const
{
daangnMultiSearch
}
=
require
(
"./search/daangnSearch"
);
const
{
joongnaSingleSearch
}
=
require
(
"./search/joongnaSearch"
);
const
{
joongnaMultiSearch
}
=
require
(
"./search/joongnaSearch"
);
const
{
bunjangSingleSearch
}
=
require
(
"./search/bunjangSearch"
);
const
{
bunjangMultiSearch
}
=
require
(
"./search/bunjangSearch"
);
//
const { daangnSingleSearch } = require("./search/daangnSearch");
//
const { daangnMultiSearch } = require("./search/daangnSearch");
//
const { joongnaSingleSearch } = require("./search/joongnaSearch");
//
const { joongnaMultiSearch } = require("./search/joongnaSearch");
//
const { bunjangSingleSearch } = require("./search/bunjangSearch");
//
const { bunjangMultiSearch } = require("./search/bunjangSearch");
const
{
marketMultiSearch
}
=
require
(
"./search/marketSearch"
);
// File search - Will be deleted (Unused)
...
...
@@ -105,7 +105,10 @@ function handleEvent(event) {
text
:
`매물이 등록되었습니다!\n등록된 매물:
${
event
.
message
.
text
}
`
,
}),
marketMultiSearch
(
event
.
message
.
text
).
then
((
res
)
=>
{
client
.
pushMessage
(
event
.
source
.
userId
,
setCarouselMessage
(
res
));
client
.
pushMessage
(
event
.
source
.
userId
,
setCarouselMessage
(
res
,
event
.
message
.
text
)
);
})
);
}
...
...
server/chatbot/message/setCarouselMessage.js
View file @
64efbe3
const
setFlexMessage
=
require
(
"./setFlexMessage"
);
function
setCarouselMessage
(
mamuls
)
{
function
setCarouselMessage
(
mamuls
,
keyword
)
{
let
flexMessages
=
[];
let
flexMessage
=
{};
if
(
...
...
@@ -102,32 +102,29 @@ function setCarouselMessage(mamuls) {
mamuls
[
i
][
"itemUrl"
],
mamuls
[
i
][
"extraInfo"
]
);
if
(
i
==
0
)
{
flexMessage
[
"header"
]
=
{
flexMessages
.
push
(
flexMessage
);
}
catch
(
err
)
{
console
.
log
(
err
);
continue
;
}
}
flexMessages
[
0
][
"header"
]
=
{
type
:
"box"
,
layout
:
"horizontal"
,
contents
:
[
{
type
:
"text"
,
text
:
"매무리 봇"
,
size
:
"sm"
,
color
:
"#1DB446"
},
{
type
:
"text"
,
text
:
`키워드: rtx3080
`
,
text
:
`키워드:
${
keyword
}
`
,
align
:
"end"
,
color
:
"#1DB446"
,
weight
:
"bold"
,
},
],
};
}
flexMessages
.
push
(
flexMessage
);
}
catch
(
err
)
{
console
.
log
(
err
);
continue
;
}
}
let
carouselMessage
=
{
type
:
"flex"
,
altText
:
"Carousel mamul message"
,
altText
:
`유저님의
${
keyword
}
매물 알림!`
,
contents
:
{
type
:
"carousel"
,
contents
:
flexMessages
,
...
...
Please
register
or
login
to post a comment