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:06:04 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b2f24a782c0266eb040d0c26226bab7debb7acf7
b2f24a78
1 parent
67d1fd40
EDIT: extraInfo parsing when \n*4 or length > 40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
2 deletions
server/chatbot/message/setCarouselMessage.js
server/chatbot/message/setCarouselMessage.js
View file @
b2f24a7
...
...
@@ -51,9 +51,47 @@ function setCarouselMessage(mamuls) {
if
(
mamuls
[
i
][
"extraInfo"
]
==
undefined
||
mamuls
[
i
][
"extraInfo"
]
==
""
)
{
mamuls
[
i
][
"extraInfo"
]
=
"없음"
;
}
else
if
(
mamuls
[
i
][
"extraInfo"
].
length
>
70
)
{
mamuls
[
i
][
"extraInfo"
]
=
mamuls
[
i
][
"extraInfo"
].
slice
(
0
,
70
)
+
"\n..."
;
}
else
{
if
(
mamuls
[
i
][
"platform"
]
===
"joongna"
||
mamuls
[
i
][
"platform"
]
===
"중고나라"
)
{
let
searchDot
=
mamuls
[
i
][
"extraInfo"
].
indexOf
(
"..."
);
if
(
searchDot
!==
-
1
)
{
mamuls
[
i
][
"extraInfo"
]
=
mamuls
[
i
][
"extraInfo"
].
slice
(
0
,
searchDot
);
}
}
console
.
log
(
`unparsed extraInfo : \n
${
mamuls
[
i
][
"extraInfo"
]}
`
);
let
searchValue
=
"\n"
;
let
pos
=
0
;
let
foundPos
=
0
;
for
(
let
j
=
0
;
j
<
4
&&
foundPos
!==
-
1
;
j
++
)
{
foundPos
=
mamuls
[
i
][
"extraInfo"
].
indexOf
(
searchValue
,
pos
);
pos
=
foundPos
+
1
;
}
console
.
log
(
`pos:
${
pos
}
`
);
if
(
foundPos
!==
1
)
{
mamuls
[
i
][
"extraInfo"
]
=
mamuls
[
i
][
"extraInfo"
].
slice
(
0
,
foundPos
)
+
"\n..."
;
console
.
log
(
`parsed extraInfo : \n
${
mamuls
[
i
][
"extraInfo"
]}
`
);
}
else
if
(
mamuls
[
i
][
"extraInfo"
].
length
>
40
)
{
mamuls
[
i
][
"extraInfo"
]
=
mamuls
[
i
][
"extraInfo"
].
slice
(
0
,
40
)
+
"\n..."
;
console
.
log
(
`parsed extraInfo : \n
${
mamuls
[
i
][
"extraInfo"
]}
`
);
}
}
// } else if (mamuls[i]["extraInfo"].length > 70) {
// mamuls[i]["extraInfo"] = mamuls[i]["extraInfo"].slice(0, 70) + "\n...";
// } else {
// }
// else if (mamuls[i]["extraInfo"].indexOf("\n") !== -1) {
// console.log(mamuls[i]["extraInfo"].indexOf("\n", 4));
// let slicePoint = mamuls[i]["extraInfo"].indexOf("\n", 4);
// mamuls[i]["extraInfo"] =
// mamuls[i]["extraInfo"].slice(0, slicePoint) + "\n...";
// }
flexMessage
=
setFlexMessage
(
mamuls
[
i
][
"platform"
],
...
...
Please
register
or
login
to post a comment