남우성

Create hole_stamp information system

......@@ -77,6 +77,7 @@ module.exports ={
}
var each_stamp = new Object;
var hole_stamp = new Object;
await axios.all(all_url.map((each) => axios.get(encodeURI(each)))).then(axios.spread((...responses) => {
for(i = 0; i < all_url.length; i++){
......@@ -87,6 +88,13 @@ module.exports ={
} else{
each_stamp[$(this).find('span').text()] = 1;
}
let one_stamp = $(this).find('span').text().split(' Lv');
if(one_stamp[0] in hole_stamp){
hole_stamp[one_stamp[0]] += 1;
} else{
hole_stamp[one_stamp[0]] = 1;
}
})
}
})).catch(error => {
......@@ -106,13 +114,26 @@ module.exports ={
each_stamp_print += each_sortary[i][0] + ': ' + each_sortary[i][1] + '% \n';
}
var hole_sortary = [];
for(var one in hole_stamp){
hole_sortary.push([one, hole_stamp[one] * 5]);
}
hole_sortary.sort(function(a, b){
return b[1] - a[1];
})
let hole_stamp_print = "";
for(i = 0; i< hole_sortary.length; i++){
hole_stamp_print += hole_sortary[i][0] + ': ' + hole_sortary[i][1] + '% \n';
}
const stampembed = new MessageEmbed()
.setColor('#F7819F')
.setTitle(class_name)
.setDescription(class_name + '의 상위 20명 각인 정보')
.addFields(
{name: "각인 상세 정보", value: each_stamp_print, inline: true},
{name: "각인 전체 정보", value: '개발중', inline: true}
{name: "각인 전체 정보", value: hole_stamp_print, inline: true},
{name: "각인 상세 정보", value: each_stamp_print, inline: true}
)
interaction.editReply({ embeds: [stampembed], allowedMentions: {repliedUser: false} });
......