유병우

Update info command

...@@ -14,5 +14,22 @@ module.exports = { ...@@ -14,5 +14,22 @@ module.exports = {
14 .setRequired(true) 14 .setRequired(true)
15 ), 15 ),
16 async execute(interaction) { 16 async execute(interaction) {
17 + const nickName = interaction.options.getString("닉네임");
18 +
19 + async function getHTML() {
20 + try {
21 + return await axios.get(encodeURI(`https://lostark.game.onstove.com/Profile/Character/${nickName}`));
22 + } catch (error) {
23 + console.error(error);
24 + }
25 + };
26 +
27 + await getHTML().then(html=>{
28 + const $ = cheerio.load(html.data);
29 + if($("div.profile-attention span:nth-child(2)").text() === "캐릭터명을 확인해주세요." || $("div.level-info2__expedition").text().split("Lv.")[1] === "0.00"){
30 + interaction.reply({content: "`"+nickName+"`"+"이라는 캐릭터는 없습니다", allowedMentions: {repliedUser: false}});
31 + return;
32 + }
33 + });
17 } 34 }
18 }; 35 };
...\ No newline at end of file ...\ No newline at end of file
......