// Selection button interaction const selectCollector = interaction.channel.createMessageComponentCollector({ componentType: ComponentType.STRING_SELECT }); selectCollector.on('collect', async (i) => { const selectedValue = i.values[0]; const ticketType = selectedValue; if (ticketType) { // Handle ticket creation based on the selected ticket type if (ticketType === 'support') { // Create the support modal const supportModal = new ModalBuilder() .setCustomId('supportmodal') .setTitle('Support Ticket Form'); // support Forms: const supportFirst = new TextInputBuilder() .setCustomId('support_first') .setLabel("🔹 Your In-game name?") .setStyle(TextInputStyle.Short); const supportSecond = new TextInputBuilder() .setCustomId('support_second') .setLabel("🔹 What are you looking for in this ticket?") .setStyle(TextInputStyle.Short); const supportThird = new TextInputBuilder() .setCustomId('support_second') .setLabel("🔹 The title of the report?") .setStyle(TextInputStyle.Short); const supportForth = new TextInputBuilder() .setCustomId('support_second') .setLabel("🔹 Please describe your question here 😉") .setStyle(TextInputStyle.Paragraph); // An action row only holds one text input, // so you need one action row per text input. const supportFirstActionRow = new ActionRowBuilder().addComponents(supportFirst); const supportSecondActionRow = new ActionRowBuilder().addComponents(supportSecond); const supportThirdActionRow = new ActionRowBuilder().addComponents(supportThird); const supportForthActionRow = new ActionRowBuilder().addComponents(supportForth); // Add inputs to the modal supportModal.addComponents(supportFirstActionRow, supportSecondActionRow, supportThirdActionRow, supportForthActionRow); // Show the modal to the user await interaction.showModal(supportModal); }; if (supportModal.isModalSubmit()) { // After submit the modal -------------------------------------------------------- const ticketName = `Support-${interaction.user.id}`; const ticketroom = await ticketChannel.threads.create({ name: ticketName, type: ChannelType.PrivateThread }); console.log(`! New support ticket thread: ${ticketroom.name}`); // Send ticket Created Embed to Panel, acknowledge user the ticket successfully created. const supportCreatedEmbed = new EmbedBuilder() .setColor('#499D6C') .setDescription(`**💌 | Ticket Created**\nOpened a new ticket: ${ticketroom}`) .setFooter({ text: bot.config.embed.footer, iconURL: bot.config.embed.serverIcon }) .setTimestamp(); await panelMessage.reply({ embeds: [supportCreatedEmbed], ephemeral: true }); // Then send the ticket Welcome Embed to the ticket room const supportWelcomeEmbed = new EmbedBuilder() .setColor('#499D6C') .setDescription(`## **💌 TICKET CREATED - SUPPORT**`) .addFields( { name: ' ', value: `Hello @${interaction.user.id}` + `Thank you for contacting support.` + `Please describe your issue and support team will response as soon as possible!` }, { name: ' ', value: `\n\n` + `[**ᴡɪᴋɪ**](https://wiki.skyhikermc.com/) **·** [**ꜱᴛᴏʀᴇ**](http://store.skyhikermc.com/) **·** ` + `[**ʀᴜʟᴇꜱ**](https://wiki.skyhikermc.com/rules) **·** [**ꜰᴀᴄᴇʙᴏᴏᴋ**](https://www.facebook.com/SkyHikerMC/) **·** ` + `[**ᴅɪꜱᴄᴏʀᴅ**](https://discord.skyhikermc.com/) ` } ) .setImage('https://s10.gifyu.com/images/S4VYM.gif') .setFooter({ text: bot.config.embed.footer, iconURL: bot.config.embed.serverIcon }) .setTimestamp(); await ticketroom.send({ embeds: [supportWelcomeEmbed], components: [ticketActionRow] }); // Send the user's filled form to the ticket room const userFormData = new EmbedBuilder() .setTitle('User Form Data') .setDescription('Form data goes here') .setFooter({ text: bot.config.embed.footer, iconURL: bot.config.embed.serverIcon }) .setTimestamp(); await ticketroom.send({ embeds: [userFormData] }); };