const { ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder, EmbedBuilder } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('configure') .setDescription(`Configure the bot to have a nice use!`), async execute(interaction) { const select_language = new StringSelectMenuBuilder() .setCustomId('choose_language') .setPlaceholder('Choose A Language!') .addOptions( new StringSelectMenuOptionBuilder() .setLabel('Français') .setDescription('Changer la langue du bot en français.') .setEmoji('🇫🇷') .setValue('french_lang'), new StringSelectMenuOptionBuilder() .setLabel('English') .setDescription('Change the bot language to english.') .setEmoji('🇺🇸') .setValue('english_lang'), new StringSelectMenuOptionBuilder() .setLabel('Exit') .setDescription('Return to the config menu.') .setEmoji('◀️') .setValue('exit_lang'), ); const select_config = new StringSelectMenuBuilder() .setCustomId('choose_config') .setPlaceholder('Choose A Configuration Option') .addOptions( new StringSelectMenuOptionBuilder() .setLabel('🏳️ - Languages Settings') .setDescription('Language Configuration') .setValue('config_flag') ); const row_lang = new ActionRowBuilder() .addComponents(select_language); const row_config = new ActionRowBuilder() .addComponents(select_config); const configEmbed = new EmbedBuilder() .setColor("#00FF00") .setTitle("Configuration Panel") .setDescription(" ⚙️ - What do you want to configure?"); const langEmbed = new EmbedBuilder() .setColor("#00FF00") .setTitle("🏳️ - Language Settings"); await interaction.reply({ embeds: [configEmbed], components: [row_config], ephemeral: true }); const filter = (interaction) => interaction.customId === 'choose_language' || interaction.customId === 'choose_config'; const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 }); collector.on('collect', async (interaction) => { if (interaction.customId === 'choose_config') { if (interaction.values[0] === 'config_flag') { await interaction.update({ embeds: [langEmbed], components: [row_lang] }); } } else if (interaction.customId === 'choose_language') { if (interaction.values[0] === 'exit_lang') { await interaction.update({ embeds: [configEmbed], components: [row_config] }); } } }); } };