Showing
1 changed file
with
39 additions
and
8 deletions
... | @@ -21,30 +21,61 @@ module.exports = { | ... | @@ -21,30 +21,61 @@ module.exports = { |
21 | .then(html => { | 21 | .then(html => { |
22 | const $ = cheerio.load(html.data); | 22 | const $ = cheerio.load(html.data); |
23 | 23 | ||
24 | - let info_island = [] | 24 | + let info_island = []; |
25 | - let info_contents = [] | 25 | + let info_contents = []; |
26 | + let All_contents = ["유령선", "카오스게이트", "필드 보스"]; | ||
26 | const $IslandList = $("ul.today-quest-list").children("li.list"); | 27 | const $IslandList = $("ul.today-quest-list").children("li.list"); |
27 | - | 28 | + const $ContentList = $("ul.item-list").children("li.list"); |
28 | - $IslandList.each(function(i, elem){ | 29 | + |
30 | + $IslandList.each(function(i, elem){ | ||
29 | info_island[i] = { | 31 | info_island[i] = { |
30 | name : $(this).find('h4.island-name span').text(), | 32 | name : $(this).find('h4.island-name span').text(), |
31 | reword : $(this).find('h5.lang-text').text() | 33 | reword : $(this).find('h5.lang-text').text() |
32 | } | 34 | } |
33 | }) | 35 | }) |
34 | 36 | ||
35 | - let island_print = "" | 37 | + $ContentList.each(function(i, elem){ |
38 | + for(var i = 0; i < All_contents.length; i++){ | ||
39 | + if($(this).find("h4.item-title span").text() === All_contents[i]){ | ||
40 | + info_contents.push($(this).find("h4.item-title span").text()); | ||
41 | + } | ||
42 | + } | ||
43 | + }) | ||
36 | 44 | ||
45 | + let island_print = ""; | ||
37 | for(var i = 0; i < info_island.length; i++){ | 46 | for(var i = 0; i < info_island.length; i++){ |
38 | - island_print += `${info_island[i].name} : ${info_island[i].reword}\n`; | 47 | + let rewordImage = ""; |
48 | + if(info_island[i].reword === "카드"){ | ||
49 | + rewordImage = "<:cardpack:976389392702791710>" | ||
50 | + } else if(info_island[i].reword === "골드"){ | ||
51 | + rewordImage = "<:golds:976389688132788245>" | ||
52 | + } else if(info_island[i].reword === "주화"){ | ||
53 | + rewordImage = "<:piratecoin:976389403662508092>" | ||
54 | + } else if(info_island[i].reword === "실링"){ | ||
55 | + rewordImage = "<:shillings:976389357558710292>" | ||
56 | + } | ||
57 | + island_print += `${info_island[i].name}: ${info_island[i].reword} ${rewordImage}\n`; | ||
58 | + } | ||
59 | + | ||
60 | + let content_print = ""; | ||
61 | + | ||
62 | + for(var i = 0; i < info_contents.length; i++){ | ||
63 | + content_print += `${info_contents[i]}\n`; | ||
64 | + } | ||
65 | + | ||
66 | + if(!content_print){ | ||
67 | + content_print = "오늘은 이용가능한 컨텐츠가 없어요"; | ||
39 | } | 68 | } |
40 | 69 | ||
41 | const termembed = new MessageEmbed() | 70 | const termembed = new MessageEmbed() |
42 | .setColor('#008B8B') | 71 | .setColor('#008B8B') |
43 | .setTitle('프로키온의 나침반') | 72 | .setTitle('프로키온의 나침반') |
44 | .setDescription(`오늘 이용가능한 컨텐츠 정보`) | 73 | .setDescription(`오늘 이용가능한 컨텐츠 정보`) |
45 | - .addField( | 74 | + .addFields( |
46 | - "모험섬", island_print | 75 | + {name: "모험섬", value: island_print, inline: true}, |
76 | + {name: "오늘의 콘텐츠", value: content_print, inline: true} | ||
47 | ) | 77 | ) |
78 | + | ||
48 | interaction.reply({ embeds: [termembed], allowedMentions: {repliedUser: false} }); | 79 | interaction.reply({ embeds: [termembed], allowedMentions: {repliedUser: false} }); |
49 | }) | 80 | }) |
50 | }, | 81 | }, | ... | ... |
-
Please register or login to post a comment