const { SlashCommandBuilder, ContainerBuilder, ButtonStyle, ButtonBuilder, TextDisplayBuilder, MessageFlags, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, ModalBuilder, LabelBuilder, UserSelectMenuBuilder } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('open-case') .setDescription('Opens a moderation case'), async execute(interaction, client) { try { const modal = new ModalBuilder().setCustomId('open-case').setTitle('Open Moderation Case') .addLabelComponents((labelBuilder) => { return labelBuilder .setStringSelectMenuComponent((menuBuilder) => { return menuBuilder .setCustomId('case-category') .setPlaceholder('Select case category') .addOptions( new StringSelectMenuOptionBuilder() .setLabel('Inquiry') .setValue('inquiry') .setDescription('General inquiry') .setEmoji('❓'), new StringSelectMenuOptionBuilder() .setLabel('Discipline') .setValue('discipline') .setDescription('Disciplinary action') .setEmoji('⚖️'), new StringSelectMenuOptionBuilder() .setLabel('Urgent') .setValue('urgent') .setDescription('Urgent case') .setEmoji('🚨'), new StringSelectMenuOptionBuilder() .setLabel('Executive') .setValue('executive') .setDescription('Executive decision') .setEmoji('👑'), ) }) .setLabel('Select the category for this case:') .setDescription('Choose the appropriate category for the moderation case.') }) .addLabelComponents((labelBuilder) => { return labelBuilder .setUserSelectMenuComponent((menuBuilder) => { return menuBuilder .setCustomId('select-user') .setPlaceholder('Select a user') .setMinValues(1) .setMaxValues(1); }) .setLabel('Select the user involved in this case:') .setDescription('Choose the user who is the subject of this moderation case.') }) .addLabelComponents((labelBuilder) => { return labelBuilder .setTextInputComponent((textInputBuilder) => { return textInputBuilder .setCustomId('case-reason') .setLabel('Reason for the case') .setStyle(TextDisplayBuilder.Paragraph) .setPlaceholder('Provide a detailed reason for opening this case...') .setRequired(true) .setMinLength(10) .setMaxLength(4000); }) .setLabel('Provide the reason for opening this case:') .setDescription('Explain why this moderation case is being opened.'); }); await interaction.showModal(modal); } catch (error) { console.error('Error showing modal:', error); await interaction.reply({ content: 'There was an error while trying to open the case modal. Please try again later.', ephemeral: true }); } } };