mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-22 08:45:55 +00:00
val stats: fix naming scheme for maps, roles and weapons after changing the api endpoint
This commit is contained in:
parent
8a45ac22de
commit
d460eff8cc
1 changed files with 41 additions and 25 deletions
|
@ -139,14 +139,22 @@ module.exports = {
|
||||||
.setDescription(`${data.username}'s top weapons stats:`);
|
.setDescription(`${data.username}'s top weapons stats:`);
|
||||||
|
|
||||||
data.top_weapons.forEach((weapon) => {
|
data.top_weapons.forEach((weapon) => {
|
||||||
weaponsEmbed.addFields({
|
if (weapon.weapon_name) {
|
||||||
name: weapon.name,
|
weaponsEmbed.addFields({
|
||||||
value:
|
name: weapon.weapon_name,
|
||||||
`Type: ${weapon.weapon_type}\n` +
|
value:
|
||||||
`Kills: ${weapon.kills}\n` +
|
`Type: ${weapon.weapon_type}\n` +
|
||||||
`Accuracy: ${weapon.accuracy.join(", ")}\n`,
|
`Kills: ${weapon.weapon_kills}\n` +
|
||||||
inline: true,
|
`Accuracy: ${
|
||||||
});
|
Array.isArray(weapon.weapon_accuracy)
|
||||||
|
? weapon.weapon_accuracy.join(", ")
|
||||||
|
: "N/A"
|
||||||
|
}\n`,
|
||||||
|
inline: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.warn("Weapon name is undefined:", weapon);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
embeds.push(weaponsEmbed);
|
embeds.push(weaponsEmbed);
|
||||||
|
@ -160,11 +168,15 @@ module.exports = {
|
||||||
.setDescription(`${data.username}'s top maps stats:`);
|
.setDescription(`${data.username}'s top maps stats:`);
|
||||||
|
|
||||||
data.top_maps.forEach((map) => {
|
data.top_maps.forEach((map) => {
|
||||||
mapsEmbed.addFields({
|
if (map.map_name) {
|
||||||
name: map.name,
|
mapsEmbed.addFields({
|
||||||
value: `Win Percentage: ${map.win_percentage}%\nMatches: ${map.matches}`,
|
name: map.map_name,
|
||||||
inline: true,
|
value: `Win Percentage: ${map.map_win_percentage}%\nMatches: ${map.map_matches}`,
|
||||||
});
|
inline: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.warn("Map name is undefined:", map);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
embeds.push(mapsEmbed);
|
embeds.push(mapsEmbed);
|
||||||
|
@ -178,18 +190,22 @@ module.exports = {
|
||||||
.setDescription(`${data.username}'s performance by role:`);
|
.setDescription(`${data.username}'s performance by role:`);
|
||||||
|
|
||||||
data.roles.forEach((role) => {
|
data.roles.forEach((role) => {
|
||||||
rolesEmbed.addFields({
|
if (role.role_name) {
|
||||||
name: role.name,
|
rolesEmbed.addFields({
|
||||||
value:
|
name: role.role_name,
|
||||||
`Win Rate: ${role.win_rate}%\n` +
|
value:
|
||||||
`KDA: ${role.kda}\n` +
|
`Win Rate: ${role.role_win_rate}%\n` +
|
||||||
`Wins: ${role.wins}\n` +
|
`KDA: ${role.role_kda}\n` +
|
||||||
`Losses: ${role.losses}\n` +
|
`Wins: ${role.role_wins}\n` +
|
||||||
`Kills: ${role.kills}\n` +
|
`Losses: ${role.role_losses}\n` +
|
||||||
`Deaths: ${role.deaths}\n` +
|
`Kills: ${role.role_kills}\n` +
|
||||||
`Assists: ${role.assists}`,
|
`Deaths: ${role.role_deaths}\n` +
|
||||||
inline: true,
|
`Assists: ${role.role_assists}`,
|
||||||
});
|
inline: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.warn("Role name is undefined:", role);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
embeds.push(rolesEmbed);
|
embeds.push(rolesEmbed);
|
||||||
|
|
Loading…
Reference in a new issue