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-23 16:16:55 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
a392a4f2f0134e8986efe73c517a305845e87f01
a392a4f2
2 parents
4f05256f
2076d42e
Merge branch 'feature/lospi' into develop
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
commands/lospi.js
commands/lospi.js
0 → 100644
View file @
a392a4f
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
(
'현재 100크리스탈 당 골드 시세를 조회합니다.'
),
async
execute
(
interaction
)
{
async
function
getHTML
()
{
try
{
return
await
axios
.
get
(
"https://www.mgx.kr/lostark/goldexchange/"
);
}
catch
(
error
)
{
console
.
error
(
error
);
}
};
await
getHTML
().
then
(
html
=>
{
const
$
=
cheerio
.
load
(
html
.
data
);
const
buyValue
=
$
(
"div.price.buy span"
).
text
();
const
sellValue
=
$
(
"div.price.sell span"
).
text
();
const
embed
=
new
MessageEmbed
()
.
setTitle
(
"크리스탈 시세"
)
.
setDescription
(
"100<:bluecrystal:952747773097295932>당 "
+
$
(
"div.searched_time"
).
text
())
.
setColor
(
"#CECEF6"
)
.
addFields
(
{
name
:
"크리스탈 구매가"
,
value
:
`
${
buyValue
}
<:gold:952804483237289994>`
,
inline
:
true
},
{
name
:
"\u200b"
,
value
:
"\u200b"
,
inline
:
true
},
{
name
:
"크리스탈 판매가"
,
value
:
`
${
sellValue
}
<:gold:952804483237289994>`
,
inline
:
true
}
);
interaction
.
reply
({
embeds
:
[
embed
],
allowedMentions
:
{
repliedUser
:
false
}});
});
},
};
\ No newline at end of file
Please
register
or
login
to post a comment