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:48:20 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
644786ef53edb54bf5b50a68a1fba31bf6350e08
644786ef
2 parents
f1c1e0fa
b29eaf6e
Merge branch 'feature/compass' into develop
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
0 deletions
commands/compass.js
commands/help.js
commands/compass.js
0 → 100644
View file @
644786e
const
{
SlashCommandBuilder
}
=
require
(
'@discordjs/builders'
);
const
{
MessageEmbed
}
=
require
(
'discord.js'
);
const
axios
=
require
(
"axios"
);
const
cheerio
=
require
(
"cheerio"
);
module
.
exports
=
{
data
:
new
SlashCommandBuilder
()
.
setName
(
'나침반'
)
.
setDescription
(
'오늘 이용가능한 프로키온의 나침반 스케줄 정보를 조회합니다.'
),
async
execute
(
interaction
)
{
const
getHtml
=
async
()
=>
{
try
{
return
await
axios
.
get
(
"https://www.loawa.com/"
)
}
catch
(
error
){
console
.
error
(
error
);
}
}
await
getHtml
()
.
then
(
html
=>
{
const
$
=
cheerio
.
load
(
html
.
data
);
let
info_island
=
[];
let
info_contents
=
[];
let
All_contents
=
[
"유령선"
,
"카오스게이트"
,
"필드 보스"
];
const
$IslandList
=
$
(
"ul.today-quest-list"
).
children
(
"li.list"
);
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
()
}
})
$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
++
){
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
(
`오늘 이용가능한 컨텐츠 정보`
)
.
addFields
(
{
name
:
"모험섬"
,
value
:
island_print
,
inline
:
true
},
{
name
:
"오늘의 콘텐츠"
,
value
:
content_print
,
inline
:
true
}
)
interaction
.
reply
({
embeds
:
[
termembed
],
allowedMentions
:
{
repliedUser
:
false
}
});
})
},
};
commands/help.js
View file @
644786e
...
...
@@ -21,7 +21,12 @@ module.exports = {
.
addField
(
'/도움 <명령어>'
,
'명령어 상세 설명'
,
true
)
.
addField
(
'/마리샵'
,
'마리샵 정보 조회'
,
true
)
.
addField
(
'/정보 <닉네임>'
,
'전투정보실 조회'
,
true
)
<<<<<<<
HEAD
.
addField
(
'/로아와 <닉네임>'
,
'로아와 조회'
,
true
);
=======
.
addField
(
'/로아와 <닉네임>'
,
'로아와 조회'
,
true
)
.
addField
(
'/나침반'
,
'금일 스케줄 조회'
,
true
);
>>>>>>>
feature
/
compass
await
interaction
.
reply
({
embeds
:
[
helpEmbed
],
allowedMentions
:
{
repliedUser
:
false
}});
}
else
if
(
helpCommand
===
"도움"
)
{
const
helpEmbed
=
new
MessageEmbed
()
...
...
@@ -47,6 +52,15 @@ module.exports = {
.
setTitle
(
`/로아와 <닉네임> 사용방법`
)
.
setDescription
(
`<닉네임>에 해당하는 캐릭터의 로아와 정보를 브라우저로 엽니다.`
);
await
interaction
.
reply
({
embeds
:
[
helpEmbed
],
allowedMentions
:
{
repliedUser
:
false
}});
<<<<<<<
HEAD
=======
}
else
if
(
helpCommand
===
"나침반"
){
const
helpEmbed
=
new
MessageEmbed
()
.
setColor
(
'#0099ff'
)
.
setTitle
(
`/나침반 사용방법`
)
.
setDescription
(
`금일 이용가능한 모험섬과 콘텐츠 정보를 제공합니다.`
);
await
interaction
.
reply
({
embeds
:
[
helpEmbed
],
allowedMentions
:
{
repliedUser
:
false
}});
>>>>>>>
feature
/
compass
}
else
{
await
interaction
.
reply
(
"해당 명령어는 없습니다."
);
}
...
...
Please
register
or
login
to post a comment