유병우

Handle exception of maintenance homepage

......@@ -12,7 +12,13 @@ module.exports = {
var isMaintainence = false;
await axios.get("https://lostark.game.onstove.com").then(html=>{
const $ = cheerio.load(html.data);
textMaintainence = $("div.time_wraper").find("h3").text();
timeMaintainence = $("strong#inspectionTime").text();
console.log(timeMaintainence);
if(textMaintainence == "예상 점검 완료 시간")
isMaintainence = true;
})
if(!isMaintainence){
const buttonsRow = new MessageActionRow()
.addComponents(
new MessageButton()
......@@ -32,6 +38,7 @@ module.exports = {
.setLabel("현재 마리샵 정보 조회")
.setStyle("SECONDARY")
);
async function getHTML() {
try {
return await axios.get("https://lostark.game.onstove.com/Shop#mari");
......@@ -99,5 +106,13 @@ module.exports = {
interaction.update({ embeds: [embed], components: [buttonsRow], allowedMentions: {repliedUser: false}});
}
});
}
else{
const embed = new MessageEmbed()
.setTitle("현재 로스트아크가 점검중입니다.")
.setColor("#FAA8F0")
.setDescription(`예상 점검 시간: ${timeMaintainence}`);
interaction.reply({ embeds: [embed], allowedMentions: {repliedUser: false} });
}
},
};
\ No newline at end of file
......