남우성

Create hole_stamp information system

...@@ -77,6 +77,7 @@ module.exports ={ ...@@ -77,6 +77,7 @@ module.exports ={
77 } 77 }
78 78
79 var each_stamp = new Object; 79 var each_stamp = new Object;
80 + var hole_stamp = new Object;
80 81
81 await axios.all(all_url.map((each) => axios.get(encodeURI(each)))).then(axios.spread((...responses) => { 82 await axios.all(all_url.map((each) => axios.get(encodeURI(each)))).then(axios.spread((...responses) => {
82 for(i = 0; i < all_url.length; i++){ 83 for(i = 0; i < all_url.length; i++){
...@@ -87,6 +88,13 @@ module.exports ={ ...@@ -87,6 +88,13 @@ module.exports ={
87 } else{ 88 } else{
88 each_stamp[$(this).find('span').text()] = 1; 89 each_stamp[$(this).find('span').text()] = 1;
89 } 90 }
91 +
92 + let one_stamp = $(this).find('span').text().split(' Lv');
93 + if(one_stamp[0] in hole_stamp){
94 + hole_stamp[one_stamp[0]] += 1;
95 + } else{
96 + hole_stamp[one_stamp[0]] = 1;
97 + }
90 }) 98 })
91 } 99 }
92 })).catch(error => { 100 })).catch(error => {
...@@ -105,14 +113,27 @@ module.exports ={ ...@@ -105,14 +113,27 @@ module.exports ={
105 for(i = 0; i < each_sortary.length; i++){ 113 for(i = 0; i < each_sortary.length; i++){
106 each_stamp_print += each_sortary[i][0] + ': ' + each_sortary[i][1] + '% \n'; 114 each_stamp_print += each_sortary[i][0] + ': ' + each_sortary[i][1] + '% \n';
107 } 115 }
108 - 116 +
117 + var hole_sortary = [];
118 + for(var one in hole_stamp){
119 + hole_sortary.push([one, hole_stamp[one] * 5]);
120 + }
121 + hole_sortary.sort(function(a, b){
122 + return b[1] - a[1];
123 + })
124 +
125 + let hole_stamp_print = "";
126 + for(i = 0; i< hole_sortary.length; i++){
127 + hole_stamp_print += hole_sortary[i][0] + ': ' + hole_sortary[i][1] + '% \n';
128 + }
129 +
109 const stampembed = new MessageEmbed() 130 const stampembed = new MessageEmbed()
110 .setColor('#F7819F') 131 .setColor('#F7819F')
111 .setTitle(class_name) 132 .setTitle(class_name)
112 .setDescription(class_name + '의 상위 20명 각인 정보') 133 .setDescription(class_name + '의 상위 20명 각인 정보')
113 .addFields( 134 .addFields(
114 - {name: "각인 상세 정보", value: each_stamp_print, inline: true}, 135 + {name: "각인 전체 정보", value: hole_stamp_print, inline: true},
115 - {name: "각인 전체 정보", value: '개발중', inline: true} 136 + {name: "각인 상세 정보", value: each_stamp_print, inline: true}
116 ) 137 )
117 138
118 interaction.editReply({ embeds: [stampembed], allowedMentions: {repliedUser: false} }); 139 interaction.editReply({ embeds: [stampembed], allowedMentions: {repliedUser: false} });
......