Merge branch 'dev' into 'main'

Dev

See merge request illegitimate/illegitimate-bot!94
This commit is contained in:
2023-11-26 15:32:07 +00:00
2 changed files with 121 additions and 93 deletions

View File

@@ -3,6 +3,7 @@
"bwfkdr": 4, "bwfkdr": 4,
"bwwins": 1500, "bwwins": 1500,
"swstars": 15, "swstars": 15,
"swkdr": 1,
"duelswins": 6000, "duelswins": 6000,
"duelswlr": 3 "duelswlr": 3
} }

View File

@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("discord.js") const { SlashCommandBuilder } = require("discord.js")
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json") const { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } = require("../../config/reqs.json")
const { color } = require("../../config/options.json") const { color } = require("../../config/options.json")
const { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js") const { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, getHeadURL } = require("../utils/utils.js")
@@ -7,6 +7,7 @@ module.exports = {
name: "check", name: "check",
description: "Check a player's stats.", description: "Check a player's stats.",
type: "slash", type: "slash",
dev: true,
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("check") .setName("check")
@@ -85,40 +86,23 @@ module.exports = {
guildTag = " [" + guild.tag + "]" guildTag = " [" + guild.tag + "]"
} }
//bedwars level const statsFields = []
const hsbwexp = player.stats.Bedwars.Experience
if (!player.stats) {
statsFields.push({
name: "<a:_warning:1178350183457751100> This player never played any games.",
value: "**➺ Stats:** `None`"
})
} else {
if (player.stats.Bedwars) {
const hsbwexp = player.stats.Bedwars.Experience || 0
const hsbwstars = bedwarsLevel(hsbwexp) const hsbwstars = bedwarsLevel(hsbwexp)
// bedwars fkdr const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
const hsbwfk = player.stats.Bedwars.final_kills_bedwars const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
const hsbwfd = player.stats.Bedwars.final_deaths_bedwars const hsbwfkdr = hsbwfk / hsbwfd || 0
const hsbwfkdr = hsbwfk / hsbwfd const hsbwwins = player.stats.Bedwars.wins_bedwars || 0
// bedwars wins
const hsbwwins = player.stats.Bedwars.wins_bedwars
// skywars level
const hsswexp = player.stats.SkyWars.skywars_experience
const hsswstars = skywarsLevel(hsswexp)
// skywars kdr
const hsswkills = player.stats.SkyWars.kills
const hsswdeaths = player.stats.SkyWars.deaths
const hsswkd = hsswkills / hsswdeaths
//skywars wins
const hsswwins = player.stats.SkyWars.wins
// dueks kdr
const hsduelskills = player.stats.Duels.kills
const hsduelsdeaths = player.stats.Duels.deaths
const hsduelskd = hsduelskills / hsduelsdeaths
// duels wins
const hsduelswins = player.stats.Duels.wins
// duels wlr
const hsduelslosses = player.stats.Duels.losses
const hsduelswlr = hsduelswins / hsduelslosses
// network level
const hypixelExp = player.networkExp
const level = hypixelLevel(hypixelExp)
let bwtitle = "" let bwtitle = ""
let swtitle = ""
let duelstitle = ""
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) { if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
bwtitle = bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements." "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
@@ -127,7 +111,35 @@ module.exports = {
"<a:check_a:1087808632172847134> This player meets the BedWars requirements." "<a:check_a:1087808632172847134> This player meets the BedWars requirements."
} }
if (hsswstars < swstars) { statsFields.push({
name: bwtitle,
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`"
})
}
if (player.stats.SkyWars) {
const hsswexp = player.stats?.SkyWars?.skywars_experience || 0
const hsswstars = skywarsLevel(hsswexp)
const hsswkills = player.stats?.SkyWars?.kills || 0
const hsswdeaths = player.stats?.SkyWars?.deaths || 0
const hsswkd = hsswkills / hsswdeaths || 0
const hsswwins = player.stats?.SkyWars?.wins || 0
let swtitle = ""
if (hsswstars < swstars || hsswkd < swkdr) {
swtitle = swtitle =
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements." "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
} else { } else {
@@ -135,6 +147,33 @@ module.exports = {
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements." "<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
} }
statsFields.push({
name: swtitle,
value: "**➺ Stars:** `" +
hsswstars.toFixed(2).toString() + " / " +
swstars.toString() + "`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() + " / " +
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) {
const hsduelskills = player.stats?.Duels?.kills || 0
const hsduelsdeaths = player.stats?.Duels?.deaths || 0
const hsduelskd = hsduelskills / hsduelsdeaths || 0
const hsduelswins = player.stats?.Duels?.wins || 0
const hsduelslosses = player.stats?.Duels?.losses || 0
const hsduelswlr = hsduelswins / hsduelslosses || 0
let duelstitle = ""
if (hsduelswins < duelswins || hsduelswlr < duelswlr) { if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
duelstitle = duelstitle =
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements." "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
@@ -143,6 +182,30 @@ module.exports = {
"<a:check_a:1087808632172847134> This player meets the Duels requirements." "<a:check_a:1087808632172847134> This player meets the Duels requirements."
} }
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
const hypixelExp = player.networkExp || 0
const level = hypixelLevel(hypixelExp)
await interaction.editReply({ await interaction.editReply({
embeds: [{ embeds: [{
title: rank + player.displayname + guildTag, title: rank + player.displayname + guildTag,
@@ -157,43 +220,7 @@ module.exports = {
text: interaction.guild.name + " | Developed by @Taken#0002", text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL() icon_url: interaction.guild.iconURL()
}, },
fields: [ fields: statsFields
{
name: bwtitle,
value: "**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() + " / " +
bwstars.toString() + "`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " + bwfkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() + " / " +
bwwins.toString() + "`"
},
{
name: swtitle,
value:
"**➺ Stars:** `" +
hsswstars.toFixed(2).toString() +
" / " + swstars.toString() + "`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() +
"`\n" +
"**➺ Wins:** `" +
hsswwins.toString() + "`"
},
{
name: duelstitle,
value: "**➺ Wins:** `" +
hsduelswins.toString() +
" / " + duelswins.toString() + "`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() +
" / " + duelswlr.toString() + "`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() + "`"
}
]
}] }]
}) })
} }