Added nicer output

This commit is contained in:
2023-03-21 19:28:39 +01:00
parent 1fee56cd1a
commit a7bd4138e6
2 changed files with 52 additions and 3 deletions

View File

@@ -45,8 +45,14 @@ module.exports = {
const userCheck = await fetch(mojang + ign);
const userUUID = userCheck.data.id;
try {
await fetch(slothPixel + userUUID);
} catch (error) {
interaction.editReply('That player doesn\'t exist. [Hypixel]')
return
}
const stats = await fetch(slothPixel + userUUID);
const guildCheck = guildAPI + userUUID
const head = minotar + ign;
if (!stats.data.uuid) {
@@ -54,6 +60,15 @@ module.exports = {
return
}
const rank_formatted = stats.data.rank_formatted
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "")
if (rank2 === "") {
var rank = ""
} else {
var rank = rank2 + " "
}
try {
const guildCheck = await fetch(guildAPI + userUUID);
var guildName = guildCheck.data.name
@@ -85,9 +100,18 @@ module.exports = {
var duelstitle = "This player meets the Duels requirements."
}
try {
const guildCheck = await fetch(guildAPI + userUUID);
const tag_formatted = guildCheck.data.tag_formatted
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "")
var guildTag = " " + guildTag2
} catch (error) {
var guildTag = ""
}
await interaction.editReply({
embeds: [{
title: stats.data.username,
title: rank + stats.data.username + guildTag,
description: "**Network Level:** `" + stats.data.level.toString() + "`\n" +
"**Current Guild:** `" + guildName + "`",
color: embedColor,

View File

@@ -32,9 +32,25 @@ module.exports = {
const userCheck = await fetch(mojang + uuid);
const ign = userCheck.data.name;
try {
await fetch(slothPixel + uuid);
} catch (error) {
interaction.editReply('That player doesn\'t exist. [Hypixel]')
return
}
const stats = await fetch(slothPixel + uuid);
const head = minotar + ign;
const rank_formatted = stats.data.rank_formatted
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "")
if (rank2 === "") {
var rank = ""
} else {
var rank = rank2 + " "
}
try {
const guildCheck = await fetch(guildAPI + uuid);
var guildName = guildCheck.data.name
@@ -66,9 +82,18 @@ module.exports = {
var duelstitle = "This player meets the Duels requirements."
}
try {
const guildCheck = await fetch(guildAPI + userUUID);
const tag_formatted = guildCheck.data.tag_formatted
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "")
var guildTag = " " + guildTag2
} catch (error) {
var guildTag = ""
}
await interaction.editReply({
embeds: [{
title: stats.data.username,
title: rank + stats.data.username + guildTag,
description: "**Network Level:** `" + stats.data.level.toString() + "`\n" +
"**Current Guild:** `" + guildName + "`",
color: embedColor,