Fixed anthoer bug

This commit is contained in:
2023-11-26 16:29:57 +01:00
parent 15074064ab
commit 2d0214c186

View File

@@ -87,115 +87,123 @@ module.exports = {
} }
const statsFields = [] const statsFields = []
if (player.stats.Bedwars) {
const hsbwexp = player.stats.Bedwars.Experience || 0
const hsbwstars = bedwarsLevel(hsbwexp)
const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
const hsbwfkdr = hsbwfk / hsbwfd || 0
const hsbwwins = player.stats.Bedwars.wins_bedwars || 0
let bwtitle = ""
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
} else {
bwtitle =
"<a:check_a:1087808632172847134> This player meets the BedWars requirements."
}
if (!player.stats) {
statsFields.push({ statsFields.push({
name: bwtitle, name: "<a:_warning:1178350183457751100> This player never played any games.",
value: "**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() + " / " +
bwstars.toString() + "`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " + bwfkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() + " / " +
bwwins.toString() + "`"
})
} else {
statsFields.push({
name: "<a:_warning:1178350183457751100> This player never played BedWars.",
value: "**➺ Stats:** `None`" value: "**➺ Stats:** `None`"
}) })
} } else {
if (player.stats.Bedwars) {
const hsbwexp = player.stats.Bedwars.Experience || 0
const hsbwstars = bedwarsLevel(hsbwexp)
const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
const hsbwfkdr = hsbwfk / hsbwfd || 0
const hsbwwins = player.stats.Bedwars.wins_bedwars || 0
if (player.stats.SkyWars) { let bwtitle = ""
const hsswexp = player.stats?.SkyWars?.skywars_experience || 0 if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
const hsswstars = skywarsLevel(hsswexp) bwtitle =
const hsswkills = player.stats?.SkyWars?.kills || 0 "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
const hsswdeaths = player.stats?.SkyWars?.deaths || 0 } else {
const hsswkd = hsswkills / hsswdeaths || 0 bwtitle =
const hsswwins = player.stats?.SkyWars?.wins || 0 "<a:check_a:1087808632172847134> This player meets the BedWars requirements."
}
let swtitle = "" statsFields.push({
if (hsswstars < swstars || hsswkd < swkdr) { name: bwtitle,
swtitle = value: "**➺ Stars:** `" +
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements." hsbwstars.toFixed(2).toString() + " / " +
bwstars.toString() + "`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " + bwfkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() + " / " +
bwwins.toString() + "`"
})
} else { } else {
swtitle = statsFields.push({
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements." name: "<a:_warning:1178350183457751100> This player never played BedWars.",
value: "**➺ Stats:** `None`"
})
} }
statsFields.push({ if (player.stats.SkyWars) {
name: swtitle, const hsswexp = player.stats?.SkyWars?.skywars_experience || 0
value: "**➺ Stars:** `" + const hsswstars = skywarsLevel(hsswexp)
hsswstars.toFixed(2).toString() + " / " + const hsswkills = player.stats?.SkyWars?.kills || 0
swstars.toString() + "`\n" + const hsswdeaths = player.stats?.SkyWars?.deaths || 0
"**➺ KDR:** `" + const hsswkd = hsswkills / hsswdeaths || 0
hsswkd.toFixed(2).toString() + " / " + const hsswwins = player.stats?.SkyWars?.wins || 0
swkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsswwins.toString() + "`"
})
} else {
statsFields.push({
name: "<a:_warning:1178350183457751100> This player never played SkyWars.",
value: "**➺ Stats:** `None`"
})
}
if (player.stats.Duels) { let swtitle = ""
const hsduelskills = player.stats?.Duels?.kills || 0 if (hsswstars < swstars || hsswkd < swkdr) {
const hsduelsdeaths = player.stats?.Duels?.deaths || 0 swtitle =
const hsduelskd = hsduelskills / hsduelsdeaths || 0 "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
const hsduelswins = player.stats?.Duels?.wins || 0 } else {
const hsduelslosses = player.stats?.Duels?.losses || 0 swtitle =
const hsduelswlr = hsduelswins / hsduelslosses || 0 "<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
}
let duelstitle = "" statsFields.push({
if (hsduelswins < duelswins || hsduelswlr < duelswlr) { name: swtitle,
duelstitle = value: "**➺ Stars:** `" +
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements." hsswstars.toFixed(2).toString() + " / " +
swstars.toString() + "`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() + " / " +
swkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsswwins.toString() + "`"
})
} else { } else {
duelstitle = statsFields.push({
"<a:check_a:1087808632172847134> This player meets the Duels requirements." name: "<a:_warning:1178350183457751100> This player never played SkyWars.",
value: "**➺ Stats:** `None`"
})
} }
statsFields.push({ if (player.stats.Duels) {
name: duelstitle, const hsduelskills = player.stats?.Duels?.kills || 0
value: const hsduelsdeaths = player.stats?.Duels?.deaths || 0
"**➺ Wins:** `" + const hsduelskd = hsduelskills / hsduelsdeaths || 0
hsduelswins.toString() + " / " + const hsduelswins = player.stats?.Duels?.wins || 0
duelswins.toString() + "`\n" + const hsduelslosses = player.stats?.Duels?.losses || 0
"**➺ WLR:** `" + const hsduelswlr = hsduelswins / hsduelslosses || 0
hsduelswlr.toFixed(2).toString() + " / " +
duelswlr.toString() + "`\n" + let duelstitle = ""
"**➺ KDR:** `" + if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
hsduelskd.toFixed(2).toString() + "`\n" duelstitle =
}) "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
} else { } else {
statsFields.push({ duelstitle =
name: "<a:_warning:1178350183457751100> This player never played Duels.", "<a:check_a:1087808632172847134> This player meets the Duels requirements."
value: "**➺ Stats:** `None`" }
})
statsFields.push({
name: duelstitle,
value:
"**➺ Wins:** `" +
hsduelswins.toString() + " / " +
duelswins.toString() + "`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() + " / " +
duelswlr.toString() + "`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() + "`\n"
})
} else {
statsFields.push({
name: "<a:_warning:1178350183457751100> This player never played Duels.",
value: "**➺ Stats:** `None`"
})
}
} }
// network level // network level
const hypixelExp = player.networkExp const hypixelExp = player.networkExp || 0
const level = hypixelLevel(hypixelExp) const level = hypixelLevel(hypixelExp)
await interaction.editReply({ await interaction.editReply({