Updated guild info command to query name and id as well
This commit is contained in:
@@ -7,7 +7,7 @@ module.exports = {
|
|||||||
name: "guild",
|
name: "guild",
|
||||||
description: "Subcommands for guilds",
|
description: "Subcommands for guilds",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: true,
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -30,9 +30,19 @@ module.exports = {
|
|||||||
.setDescription("Get info about a guild.")
|
.setDescription("Get info about a guild.")
|
||||||
.addStringOption(option =>
|
.addStringOption(option =>
|
||||||
option
|
option
|
||||||
.setName("ign")
|
.setName("query")
|
||||||
.setDescription("The IGN of a member.")
|
.setDescription("The IGN of a member.")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
|
).
|
||||||
|
addStringOption(option =>
|
||||||
|
option
|
||||||
|
.setName("type")
|
||||||
|
.setDescription("The type of query.")
|
||||||
|
.addChoices(
|
||||||
|
{ name: "Guild Member", value: "ign" },
|
||||||
|
{ name: "Guild Name", value: "name" },
|
||||||
|
{ name: "Guild Id", value: "id" }
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ const { color, devMessage } = require("../../../config/options.json")
|
|||||||
|
|
||||||
async function guildInfo(interaction) {
|
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"))
|
const embedColor = Number(color.replace("#", "0x"))
|
||||||
|
let guild
|
||||||
|
|
||||||
|
if (type === "ign") {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
description: "Fetching your uuid...",
|
description: "Fetching your uuid...",
|
||||||
@@ -15,7 +18,7 @@ async function guildInfo(interaction) {
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
const uuid = await getUUID(ign)
|
const uuid = await getUUID(query)
|
||||||
if (!uuid) {
|
if (!uuid) {
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
@@ -51,7 +54,7 @@ async function guildInfo(interaction) {
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
const guild = await getGuild(uuid)
|
guild = await getGuild(uuid, "player")
|
||||||
if (!guild) {
|
if (!guild) {
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
@@ -61,6 +64,43 @@ async function guildInfo(interaction) {
|
|||||||
})
|
})
|
||||||
return
|
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
|
const guildName = guild.name
|
||||||
const guildCreatedMS = guild.created
|
const guildCreatedMS = guild.created
|
||||||
|
|||||||
Reference in New Issue
Block a user