Moved subcommand builder to their files

This commit is contained in:
2025-03-23 15:01:08 +01:00
parent 95f9bb723f
commit 62a56e3c1c
10 changed files with 108 additions and 104 deletions

View File

@@ -1,9 +1,9 @@
import { InteractionContextType, SlashCommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { ICommand } from "~/typings"
import guildInfo from "./guild/info"
import guildMember from "./guild/member"
import guildTop from "./guild/top"
import guildInfo, { infoSub } from "./guild/info"
import guildMember, { memberSub } from "./guild/member"
import guildTop, { topSub } from "./guild/top"
export default {
name: "guild",
@@ -15,66 +15,9 @@ export default {
data: new SlashCommandBuilder()
.setName("guild")
.setDescription("Subcommands for guilds")
.addSubcommand(subcommand =>
subcommand
.setName("member")
.setDescription("Get info about a guild memeber")
.addStringOption(option =>
option
.setName("ign")
.setDescription("The IGN of the player.")
.setMinLength(3)
.setMaxLength(16)
.setRequired(true)
)
)
.addSubcommand(subcommand =>
subcommand
.setName("info")
.setDescription("Get info about a guild.")
.addStringOption(option =>
option
.setName("query")
.setDescription("The query to search for. [Default: player]")
.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" }
)
)
)
.addSubcommand(subcommand =>
subcommand
.setName("top")
.setDescription("Get the top guild members based on gexp")
.addStringOption(option =>
option
.setName("query")
.setDescription("The query to search for. [Default: player]")
.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" }
)
)
.addNumberOption(option =>
option
.setName("amount")
.setDescription("The amount of guild members to show. [Default: 10]")
)
)
.addSubcommand(memberSub)
.addSubcommand(infoSub)
.addSubcommand(topSub)
.setContexts(InteractionContextType.Guild),
async execute({ interaction }) {

View File

@@ -1,8 +1,29 @@
import { SlashCommandSubcommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { IGuildData, SubCommand } from "~/typings"
import { dateTimeFormatter, numberFormatter } from "~/utils/Functions/intlFormaters"
import { getGuild, getIGN, getPlayer, getUUID, guildLevel } from "~/utils/Hypixel"
export const infoSub = new SlashCommandSubcommandBuilder()
.setName("info")
.setDescription("Get info about a guild.")
.addStringOption(option =>
option
.setName("query")
.setDescription("The query to search for. [Default: player]")
.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" }
)
)
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()

View File

@@ -1,8 +1,21 @@
import { SlashCommandSubcommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { SubCommand } from "~/typings"
import { dateTimeFormatter, numberFormatter } from "~/utils/Functions/intlFormaters"
import { getGuild, getHeadURL, getPlayer, getUUID } from "~/utils/Hypixel"
export const memberSub = new SlashCommandSubcommandBuilder()
.setName("member")
.setDescription("Get info about a guild memeber")
.addStringOption(option =>
option
.setName("ign")
.setDescription("The IGN of the player.")
.setMinLength(3)
.setMaxLength(16)
.setRequired(true)
)
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()

View File

@@ -1,9 +1,35 @@
import { SlashCommandSubcommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { IGuildData, SubCommand } from "~/typings"
import { numberFormatter } from "~/utils/Functions/intlFormaters"
import { getGuild, getIGN, getPlayer, getUUID } from "~/utils/Hypixel"
import { redis } from "~/utils/Illegitimate"
export const topSub = new SlashCommandSubcommandBuilder()
.setName("top")
.setDescription("Get the top guild members based on gexp")
.addStringOption(option =>
option
.setName("query")
.setDescription("The query to search for. [Default: player]")
.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" }
)
)
.addNumberOption(option =>
option
.setName("amount")
.setDescription("The amount of guild members to show. [Default: 10]")
)
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()

View File

@@ -1,11 +1,11 @@
import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"
import { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, SlashCommandSubcommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { ICommand } from "~/typings"
import beast from "./staff/beast"
import help from "./staff/help"
import prune from "./staff/prune"
import removeGuildRoles from "./staff/removeguildroles"
import updateAll from "./staff/updateall"
import beast, { beastSub } from "./staff/beast"
import help, { helpSub } from "./staff/help"
import prune, { pruneSub } from "./staff/prune"
import removeGuildRoles, { removeGuildRolesSub } from "./staff/removeguildroles"
import updateAll, { updateAllSub } from "./staff/updateall"
export default {
name: "staff",
@@ -17,37 +17,11 @@ export default {
data: new SlashCommandBuilder()
.setName("staff")
.setDescription("Subcommands for staff")
.addSubcommand(subcommand =>
subcommand
.setName("help")
.setDescription("Get help with staff commands")
)
.addSubcommand(subcommand =>
subcommand
.setName("beast")
.setDescription("Check a user for beast reqs")
.addStringOption(option =>
option
.setName("ign")
.setDescription("The IGN of the player.")
.setRequired(true)
)
)
.addSubcommand(subcommand =>
subcommand
.setName("prune")
.setDescription("Update the discord roles of all guild members")
)
.addSubcommand(subcommand =>
subcommand
.setName("removeguildroles")
.setDescription("Remove guild roles from non members")
)
.addSubcommand(subcommand =>
subcommand
.setName("updateall")
.setDescription("Update the discord roles of all guild members")
)
.addSubcommand(helpSub)
.addSubcommand(beastSub)
.addSubcommand(pruneSub)
.addSubcommand(removeGuildRolesSub)
.addSubcommand(updateAllSub)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setContexts(InteractionContextType.Guild),

View File

@@ -1,8 +1,19 @@
import { SlashCommandSubcommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { beastbwfkdr, beastbwstars, beastduelswins, beastswkdr, beastswstars, bwwins, duelswlr } from "~/config/reqs"
import { SubCommand } from "~/typings"
import { bedwarsLevel, getGuild, getHeadURL, getPlayer, getUUID, hypixelLevel, skywarsLevel } from "~/utils/Hypixel"
export const beastSub = new SlashCommandSubcommandBuilder()
.setName("beast")
.setDescription("Check a user for beast reqs")
.addStringOption(option =>
option
.setName("ign")
.setDescription("The IGN of the player.")
.setRequired(true)
)
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()

View File

@@ -1,7 +1,11 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ComponentType, MessageFlags } from "discord.js"
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ComponentType, MessageFlags, SlashCommandSubcommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { SubCommmndClient } from "~/typings"
export const helpSub = new SlashCommandSubcommandBuilder()
.setName("help")
.setDescription("Get help with staff commands")
const cmd: SubCommmndClient = async (interaction, client) => {
await interaction.deferReply()

View File

@@ -1,8 +1,12 @@
import { ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, ComponentType } from "discord.js"
import { ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, ComponentType, SlashCommandSubcommandBuilder } from "discord.js"
import { devMessage, embedColor } from "~/config/options"
import { SubCommand } from "~/typings"
import env from "~/utils/Env"
export const pruneSub = new SlashCommandSubcommandBuilder()
.setName("prune")
.setDescription("Update the discord roles of all guild members")
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()

View File

@@ -1,4 +1,4 @@
import { GuildMember } from "discord.js"
import { GuildMember, SlashCommandSubcommandBuilder } from "discord.js"
import { getVerifies } from "src/drizzle/functions"
import { embedColor, hypixelGuildID } from "~/config/options"
import { IGuildData, SubCommand } from "~/typings"
@@ -6,6 +6,10 @@ import env from "~/utils/Env"
import roleManage from "~/utils/Functions/rolesmanage"
import { getGuild } from "~/utils/Hypixel"
export const removeGuildRolesSub = new SlashCommandSubcommandBuilder()
.setName("removeguildroles")
.setDescription("Remove guild roles from non members")
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()

View File

@@ -1,4 +1,4 @@
import { ChannelType, GuildMember } from "discord.js"
import { ChannelType, GuildMember, SlashCommandSubcommandBuilder } from "discord.js"
import { getVerifies } from "src/drizzle/functions"
import { embedColor, hypixelGuildID } from "~/config/options"
import { IGuildData, SubCommand } from "~/typings"
@@ -8,6 +8,10 @@ import roleManage from "~/utils/Functions/rolesmanage"
import { getGuild, getIGN } from "~/utils/Hypixel"
import { log } from "~/utils/Logger"
export const updateAllSub = new SlashCommandSubcommandBuilder()
.setName("updateall")
.setDescription("Update the discord roles of all guild members")
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()