.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { hypixelApiKey } = require('../config.json');
|
||||
const { color } = require('../config/options.json');
|
||||
const axios = require('axios');
|
||||
const fetch = require('axios');
|
||||
|
||||
module.exports = {
|
||||
name: 'check',
|
||||
@@ -20,9 +20,7 @@ module.exports = {
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.reply({content: "command is currently under development.", ephemeral: true})
|
||||
|
||||
// await interaction.deferReply();
|
||||
await interaction.deferReply({})
|
||||
|
||||
const ign = interaction.options.getString('ign');
|
||||
const mojang = "https://api.mojang.com/users/profiles/minecraft/"
|
||||
@@ -30,29 +28,43 @@ module.exports = {
|
||||
const guildAPI = "https://api.slothpixel.me/api/guilds/"
|
||||
const minotar = "https://minotar.net/helm/";
|
||||
const embedColor = Number(color.replace("#", "0x"));
|
||||
|
||||
const userCheck = await axios.get(mojang + ign);
|
||||
const userUUID = userCheck.data.id;
|
||||
|
||||
const stats = await axios.get(slothPixel + userUUID);
|
||||
const guildCheck = await axios.get(guildAPI + userUUID);
|
||||
const head = minotar + ign;
|
||||
|
||||
if (!ign) {
|
||||
interaction.editReply('Please provide a player\'s IGN.')
|
||||
await interaction.editReply('Please provide a player\'s IGN.')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await fetch(mojang + ign);
|
||||
} catch (error) {
|
||||
interaction.editReply('That player doesn\'t exist. [Mojang]')
|
||||
return
|
||||
}
|
||||
|
||||
const userCheck = await fetch(mojang + ign);
|
||||
const userUUID = userCheck.data.id;
|
||||
|
||||
const stats = await fetch(slothPixel + userUUID);
|
||||
const guildCheck = guildAPI + userUUID
|
||||
const head = minotar + ign;
|
||||
|
||||
if (!stats.data.uuid) {
|
||||
interaction.reply('That player doesn\'t exist. [Hypixel]')
|
||||
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
try {
|
||||
const guildCheck = await fetch(guildAPI + userUUID);
|
||||
var guildName = guildCheck.data.name
|
||||
} catch (error) {
|
||||
var guildName = "None"
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: stats.data.username,
|
||||
description: "**Network Level:** `" + stats.data.level.toString() + "`\n" +
|
||||
"**Current Guild:** `" + guildCheck.data.name + "`",
|
||||
"**Current Guild:** `" + guildName + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head
|
||||
@@ -82,7 +94,6 @@ module.exports = {
|
||||
}
|
||||
]
|
||||
}]
|
||||
|
||||
})
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,8 @@
|
||||
const { color } = require('../../config/options.json');
|
||||
const { dev } = require('../../config.json');
|
||||
const fetch = require('axios');
|
||||
const mongoose = require('mongoose');
|
||||
const guildapp = require('../../schemas/guildAppSchema.js');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
@@ -17,8 +19,8 @@ module.exports = {
|
||||
const embed = message.embeds[0];
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
|
||||
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
|
||||
const uuid = fs.readFileSync(filePath, 'utf8');
|
||||
const guildappdata = await guildapp.findOne({ userID: applicantId })
|
||||
const uuid = guildappdata.uuid;
|
||||
|
||||
const mojang = "https://api.mojang.com/user/profile/"
|
||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||
@@ -28,22 +30,17 @@ module.exports = {
|
||||
|
||||
const userCheck = await fetch(mojang + uuid);
|
||||
const ign = userCheck.data.name;
|
||||
const guildCheck = await fetch(guildAPI + uuid);
|
||||
|
||||
const stats = await fetch(slothPixel + uuid);
|
||||
const head = minotar + ign;
|
||||
|
||||
if (!userCheck.data.id) {
|
||||
interaction.editReply('That player doesn\'t exist. [Mojang]')
|
||||
return
|
||||
try {
|
||||
const guildCheck = await fetch(guildAPI + uuid);
|
||||
var guildName = guildCheck.data.name
|
||||
} catch (error) {
|
||||
var guildName = "None"
|
||||
}
|
||||
|
||||
if (!stats.data.uuid) {
|
||||
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
||||
return
|
||||
}
|
||||
|
||||
const guildName = guildCheck.data.name ?? "None"
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: stats.data.username,
|
||||
|
||||
Reference in New Issue
Block a user