Updated guild info command to query name and id as well
This commit is contained in:
@@ -5,61 +5,101 @@ const { color, devMessage } = require("../../../config/options.json")
|
||||
|
||||
async function guildInfo(interaction) {
|
||||
|
||||
const ign = interaction.options.getString("ign")
|
||||
const query = interaction.options.getString("query")
|
||||
const type = interaction.options.getString("type") || "ign"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
let guild
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(ign)
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
if (type === "ign") {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That player doen't exist!",
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
const uuid = await getUUID(query)
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That player doen't exist!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That player has never joined the server!",
|
||||
description: "Fetching your player data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
const player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That player has never joined the server!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That player is not in a guild!",
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
|
||||
guild = await getGuild(uuid, "player")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That player is not in a guild!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
} else if (type === "name") {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "name")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
} else if (type === "id") {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "id")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const guildName = guild.name
|
||||
|
||||
Reference in New Issue
Block a user