유병우

Handle exception of nonexistent nickname in loawa.js

...@@ -23,6 +23,10 @@ module.exports = { ...@@ -23,6 +23,10 @@ module.exports = {
23 }; 23 };
24 await getHTML().then(html=>{ 24 await getHTML().then(html=>{
25 const $ = cheerio.load(html.data); 25 const $ = cheerio.load(html.data);
26 + if($("div.profile-attention span:nth-child(2)").text() === "캐릭터명을 확인해주세요." || $("div.level-info2__expedition").text().split("Lv.")[1] === "0.00"){
27 + interaction.reply({content: "`"+interaction.options.getString("닉네임")+"`"+"이라는 캐릭터는 없습니다", allowedMentions: {repliedUser: false}});
28 + return;
29 + }
26 open(`https://loawa.com/char/${interaction.options.getString("닉네임")}`); 30 open(`https://loawa.com/char/${interaction.options.getString("닉네임")}`);
27 interaction.reply({content: `${interaction.options.getString("닉네임")}의 로아와 정보로 이동합니다.`, allowedMentions: {repliedUser: false}}); 31 interaction.reply({content: `${interaction.options.getString("닉네임")}의 로아와 정보로 이동합니다.`, allowedMentions: {repliedUser: false}});
28 }); 32 });
......