From 962a76fbeaa30e3be48944122e6e21a6a69ba7f5 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 3 Dec 2023 18:44:01 +0100 Subject: [PATCH] Added dynamic embeds --- src/commands/check.js | 21 ++++++++++++++++++ src/commands/forceupdate.js | 15 +++++++++++++ src/commands/forceverify.js | 21 ++++++++++++++++++ src/commands/guild/info.js | 21 ++++++++++++++++++ src/commands/guild/member.js | 43 ++++++++++++++++++++++++++---------- src/commands/staff/beast.js | 21 ++++++++++++++++++ src/commands/update.js | 25 +++++++++++++++++++-- src/commands/verify.js | 36 ++++++++++++++++++++++++++++++ 8 files changed, 189 insertions(+), 14 deletions(-) diff --git a/src/commands/check.js b/src/commands/check.js index d0f816e..ead5827 100644 --- a/src/commands/check.js +++ b/src/commands/check.js @@ -31,6 +31,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] + }) + const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ @@ -41,6 +48,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your player data...", + color: embedColor + }] + }) + const head = await getHeadURL(ign) const player = await getPlayer(uuid) if (!player) { @@ -69,6 +83,13 @@ module.exports = { rank = "[MVP++] " } + await interaction.editReply({ + embeds: [{ + description: "Checking your guild data...", + color: embedColor + }] + }) + const guild = await getGuild(uuid) let guildName = "" if (!guild) { diff --git a/src/commands/forceupdate.js b/src/commands/forceupdate.js index 8fb3068..d633d0b 100644 --- a/src/commands/forceupdate.js +++ b/src/commands/forceupdate.js @@ -51,8 +51,23 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching ign...", + color: embedColor, + }] + }) + const ign = await getIGN(verifyData.uuid) const head = await getHeadURL(ign) + + await interaction.editReply({ + embeds: [{ + description: "Fetching guild data...", + color: embedColor, + }] + }) + const guild = await getGuild(verifyData.uuid) let responseGuildID = "" diff --git a/src/commands/forceverify.js b/src/commands/forceverify.js index 1a3188e..2730636 100644 --- a/src/commands/forceverify.js +++ b/src/commands/forceverify.js @@ -69,6 +69,13 @@ module.exports = { modName = mod.username + "#" + mod.discriminator } + await interaction.editReply({ + embeds: [{ + description: "Fetching their uuid...", + color: embedColor + }] + }) + const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ @@ -80,6 +87,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching their player data...", + color: embedColor + }] + }) + const player = await getPlayer(uuid) if (!player) { interaction.editReply({ @@ -91,6 +105,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching their guild data...", + color: embedColor + }] + }) + const guild = await getGuild(uuid) let responseGuildID = "" if (!guild) { diff --git a/src/commands/guild/info.js b/src/commands/guild/info.js index 1e37592..5da89fe 100644 --- a/src/commands/guild/info.js +++ b/src/commands/guild/info.js @@ -8,6 +8,13 @@ async function guildInfo(interaction) { const ign = interaction.options.getString("ign") const embedColor = Number(color.replace("#", "0x")) + await interaction.editReply({ + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] + }) + const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ @@ -19,6 +26,13 @@ async function guildInfo(interaction) { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your player data...", + color: embedColor + }] + }) + const player = await getPlayer(uuid) if (!player) { interaction.editReply({ @@ -30,6 +44,13 @@ async function guildInfo(interaction) { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] + }) + const guild = await getGuild(uuid) if (!guild) { interaction.editReply({ diff --git a/src/commands/guild/member.js b/src/commands/guild/member.js index b7aa45c..d97e2f6 100644 --- a/src/commands/guild/member.js +++ b/src/commands/guild/member.js @@ -7,6 +7,13 @@ async function guildMember(interaction) { const ign = interaction.options.getString("ign") const embedColor = Number(color.replace("#", "0x")) + await interaction.editReply({ + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] + }) + const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ @@ -20,6 +27,13 @@ async function guildMember(interaction) { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your player data...", + color: embedColor + }] + }) + const head = await getHeadURL(ign) const player = await getPlayer(uuid) if (!player) { @@ -58,22 +72,27 @@ async function guildMember(interaction) { rank = "[MVP++] " } + await interaction.editReply({ + embeds: [{ + description: "Checking your guild data...", + color: embedColor + }] + }) + const guild = await getGuild(uuid) if (!guild) { await interaction.editReply({ - embeds: [ - { - description: "This user is not in a guild", - color: embedColor, - thumbnail: { - url: head, - }, - footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, + embeds: [{ + description: "This user is not in a guild", + color: embedColor, + thumbnail: { + url: head, }, - ], + footer: { + text: interaction.guild.name + " | " + devMessage, + icon_url: interaction.guild.iconURL({ dynamic: true }), + }, + }], }) return } diff --git a/src/commands/staff/beast.js b/src/commands/staff/beast.js index fd08f78..4ca01d6 100644 --- a/src/commands/staff/beast.js +++ b/src/commands/staff/beast.js @@ -14,6 +14,13 @@ async function beast(interaction) { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] + }) + const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ @@ -24,6 +31,13 @@ async function beast(interaction) { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your player data...", + color: embedColor + }] + }) + const head = await getHeadURL(ign) const player = await getPlayer(uuid) if (!player) { @@ -52,6 +66,13 @@ async function beast(interaction) { rank = "[MVP++] " } + await interaction.editReply({ + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] + }) + const guild = await getGuild(uuid) let guildName = "" if (!guild) { diff --git a/src/commands/update.js b/src/commands/update.js index a6affd1..fe33e6f 100644 --- a/src/commands/update.js +++ b/src/commands/update.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder } = require("discord.js") +const { SlashCommandBuilder, InteractionResponse } = require("discord.js") const { getGuild, getIGN, getHeadURL } = require("../utils/utils.js") const verify = require("../schemas/verifySchema.js") const { color, hypixelGuildID, devMessage } = require("../../config/options.json") @@ -9,7 +9,7 @@ module.exports = { name: "update", description: "Update your guild rank.", type: "slash", - dev: true, + dev: false, public: true, data: new SlashCommandBuilder() @@ -43,6 +43,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your guild data...", + color: embedColor, + }] + }) + const guild = await getGuild(verifyData.uuid) let guildID = "" if (!guild) { @@ -55,6 +62,12 @@ module.exports = { const head = await getHeadURL(ign) if (guildID !== hypixelGuildID) { + await interaction.editReply({ + description: "You are not a member of illegitimate\n" + + "Just a moment while I update your roles...", + color: embedColor, + }) + for (let i = 0; i < removeThese.length; i++) { await roleManage.remove(removeThese[i], "Auto role removal. (Update)") } @@ -77,6 +90,14 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "You are a member of illegitimate\n" + + "Just a moment while I update your roles...", + color: embedColor, + }] + }) + if (guildID === hypixelGuildID) { const GuildMembers = guild.members diff --git a/src/commands/verify.js b/src/commands/verify.js index 68fc0eb..df7e379 100644 --- a/src/commands/verify.js +++ b/src/commands/verify.js @@ -47,6 +47,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] + }) + const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ @@ -58,6 +65,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Fetching your player data...", + color: embedColor + }] + }) + const head = await getHeadURL(ign) const player = await getPlayer(uuid) if (!player) { @@ -77,6 +91,13 @@ module.exports = { username = user1.username + "#" + user1.discriminator } + await interaction.editReply({ + embeds: [{ + description: "Checking your Discord tag...", + color: embedColor + }] + }) + const linkedDiscord = player?.socialMedia?.links?.DISCORD || null if (!linkedDiscord) { interaction.editReply({ @@ -104,6 +125,13 @@ module.exports = { return } + await interaction.editReply({ + embeds: [{ + description: "Checking your guild...", + color: embedColor + }] + }) + const guild = await getGuild(uuid) let guildID = "" if (!guild) { @@ -113,6 +141,14 @@ module.exports = { } if (guildID === hypixelGuildID) { + + await interaction.editReply({ + embeds: [{ + description: "You are a member of the guild `" + guild.name + "`!", + color: embedColor + }] + }) + const GuildMembers = guild.members const guildRank = GuildMembers.find((member) => member.uuid === player.uuid).rank