Updated commands using hypixel api to use utils

This commit is contained in:
2023-11-17 17:41:20 +01:00
parent 6c7afbe98a
commit d0d9524ae6
6 changed files with 58 additions and 106 deletions

View File

@@ -1,7 +1,7 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js');
const { getIGN, getHeadURL } = require('../utils/utils.js')
const { color } = require('../config/options.json');
const verify = require('../schemas/verifySchema.js');
const fetch = require('axios');
module.exports = {
name: 'whois',
@@ -27,19 +27,15 @@ module.exports = {
const user = interaction.options.getUser('user');
const embedColor = Number(color.replace("#", "0x"));
const mojang = "https://api.mojang.com/user/profile/"
const minotar = "https://minotar.net/helm/";
const verifiedUser = await verify.findOne({ userID: user.id });
if (!verifiedUser) {
interaction.editReply({ content: 'This user has not verified their account.' });
return
}
const userCheck = await fetch(mojang + verifiedUser.uuid);
const ign = userCheck.data.name;
const head = minotar + ign;
const ign = await getIGN(verifiedUser.uuid);
const head = await getHeadURL(ign)
await interaction.editReply({
embeds: [{