Fixed the guild tag from now showing
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require("discord.js");
|
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require("discord.js");
|
||||||
const { bwfdkr, bwstars, bwwins, duelswins, swstars } = require("../config/reqs.json");
|
const { bwfdkr, bwstars, bwwins, duelswins, swstars } = require("../config/reqs.json");
|
||||||
const getuuid = require("../utils/functions.js");
|
|
||||||
const env = require("dotenv").config();
|
const env = require("dotenv").config();
|
||||||
const hypixelApiKey = process.env.HYPIXELAPI;
|
const hypixelApiKey = process.env.HYPIXELAPI;
|
||||||
const { color } = require("../config/options.json");
|
const { color } = require("../config/options.json");
|
||||||
@@ -39,29 +38,46 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
await fetch(mojang + ign);
|
await fetch(mojang + ign);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
interaction.editReply("That player doesn't exist. [Mojang]");
|
interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "That player doesn't exist.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uuid = await fetch(mojang + ign);
|
const userCheck = await fetch(mojang + ign);
|
||||||
|
const uuid = userCheck.data.id;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fetch(slothPixel + uuid.data.id);
|
await fetch(slothPixel + uuid);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
interaction.editReply("That player doesn't exist. [Hypixel]");
|
interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "That player hasn't played Hypixel before.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stats = await fetch(slothPixel + uuid.data.id);
|
const stats = await fetch(slothPixel + uuid);
|
||||||
const head = minotar + ign;
|
const head = minotar + ign;
|
||||||
|
|
||||||
if (!stats.data.uuid) {
|
if (!stats.data.uuid) {
|
||||||
interaction.editReply("That player doesn't exist. [Hypixel]");
|
interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "That player hasn't played Hypixel before.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rank_formatted = stats.data.rank_formatted;
|
const rank_formatted = stats.data.rank_formatted;
|
||||||
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "");
|
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "");
|
||||||
|
const guildCheck = await fetch(guildAPI + uuid);
|
||||||
|
|
||||||
if (rank2 === "") {
|
if (rank2 === "") {
|
||||||
var rank = "";
|
var rank = "";
|
||||||
@@ -70,7 +86,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
var guildName = guildCheck.data.name;
|
var guildName = guildCheck.data.name;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
var guildName = "None";
|
var guildName = "None";
|
||||||
@@ -101,7 +116,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
const tag_formatted = guildCheck.data.tag_formatted;
|
const tag_formatted = guildCheck.data.tag_formatted;
|
||||||
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "");
|
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "");
|
||||||
var guildTag = " " + guildTag2;
|
var guildTag = " " + guildTag2;
|
||||||
|
|||||||
@@ -31,12 +31,18 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
await fetch(slothPixel + uuid);
|
await fetch(slothPixel + uuid);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "That player hasn't played Hypixel before.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const stats = await fetch(slothPixel + uuid);
|
const stats = await fetch(slothPixel + uuid);
|
||||||
const head = minotar + ign;
|
const head = minotar + ign;
|
||||||
|
const guildCheck = await fetch(guildAPI + uuid);
|
||||||
|
|
||||||
const rank_formatted = stats.data.rank_formatted
|
const rank_formatted = stats.data.rank_formatted
|
||||||
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "")
|
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "")
|
||||||
@@ -48,7 +54,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const guildCheck = await fetch(guildAPI + uuid);
|
|
||||||
var guildName = guildCheck.data.name
|
var guildName = guildCheck.data.name
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
var guildName = "None"
|
var guildName = "None"
|
||||||
@@ -79,7 +84,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
const tag_formatted = guildCheck.data.tag_formatted
|
const tag_formatted = guildCheck.data.tag_formatted
|
||||||
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "")
|
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "")
|
||||||
var guildTag = " " + guildTag2
|
var guildTag = " " + guildTag2
|
||||||
|
|||||||
Reference in New Issue
Block a user