Toggle navigation
Toggle navigation
This project
Loading...
Sign in
유병우
/
lostark-discord-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-18 17:06:23 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1745948c88ac2308d0c60d75a153eee4a4934f75
1745948c
1 parent
46c0fbc9
Create contents information supply method
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
8 deletions
commands/compass.js
commands/compass.js
View file @
1745948
...
...
@@ -21,30 +21,61 @@ module.exports = {
.
then
(
html
=>
{
const
$
=
cheerio
.
load
(
html
.
data
);
let
info_island
=
[]
let
info_contents
=
[]
let
info_island
=
[];
let
info_contents
=
[];
let
All_contents
=
[
"유령선"
,
"카오스게이트"
,
"필드 보스"
];
const
$IslandList
=
$
(
"ul.today-quest-list"
).
children
(
"li.list"
);
$IslandList
.
each
(
function
(
i
,
elem
){
const
$ContentList
=
$
(
"ul.item-list"
).
children
(
"li.list"
);
$IslandList
.
each
(
function
(
i
,
elem
){
info_island
[
i
]
=
{
name
:
$
(
this
).
find
(
'h4.island-name span'
).
text
(),
reword
:
$
(
this
).
find
(
'h5.lang-text'
).
text
()
}
})
let
island_print
=
""
$ContentList
.
each
(
function
(
i
,
elem
){
for
(
var
i
=
0
;
i
<
All_contents
.
length
;
i
++
){
if
(
$
(
this
).
find
(
"h4.item-title span"
).
text
()
===
All_contents
[
i
]){
info_contents
.
push
(
$
(
this
).
find
(
"h4.item-title span"
).
text
());
}
}
})
let
island_print
=
""
;
for
(
var
i
=
0
;
i
<
info_island
.
length
;
i
++
){
island_print
+=
`
${
info_island
[
i
].
name
}
:
${
info_island
[
i
].
reword
}
\n`
;
let
rewordImage
=
""
;
if
(
info_island
[
i
].
reword
===
"카드"
){
rewordImage
=
"<:cardpack:976389392702791710>"
}
else
if
(
info_island
[
i
].
reword
===
"골드"
){
rewordImage
=
"<:golds:976389688132788245>"
}
else
if
(
info_island
[
i
].
reword
===
"주화"
){
rewordImage
=
"<:piratecoin:976389403662508092>"
}
else
if
(
info_island
[
i
].
reword
===
"실링"
){
rewordImage
=
"<:shillings:976389357558710292>"
}
island_print
+=
`
${
info_island
[
i
].
name
}
:
${
info_island
[
i
].
reword
}
${
rewordImage
}
\n`
;
}
let
content_print
=
""
;
for
(
var
i
=
0
;
i
<
info_contents
.
length
;
i
++
){
content_print
+=
`
${
info_contents
[
i
]}
\n`
;
}
if
(
!
content_print
){
content_print
=
"오늘은 이용가능한 컨텐츠가 없어요"
;
}
const
termembed
=
new
MessageEmbed
()
.
setColor
(
'#008B8B'
)
.
setTitle
(
'프로키온의 나침반'
)
.
setDescription
(
`오늘 이용가능한 컨텐츠 정보`
)
.
addField
(
"모험섬"
,
island_print
.
addFields
(
{
name
:
"모험섬"
,
value
:
island_print
,
inline
:
true
},
{
name
:
"오늘의 콘텐츠"
,
value
:
content_print
,
inline
:
true
}
)
interaction
.
reply
({
embeds
:
[
termembed
],
allowedMentions
:
{
repliedUser
:
false
}
});
})
},
...
...
Please
register
or
login
to post a comment