const user_perm_error = new Discord.MessageEmbed() .setColor("RED") .setTitle(" You need to have `ADMINISTRATOR` Permission to use the command") if (!message.member.permissions.has("ADMINISTRATOR")) { return message.channel.send({embeds: [user_perm_error]}); } first_layer() async function first_layer(){ let menuoptions = [ { label: "Genaral", value: "general", description: `${await client.tickets.get(`${message.guild.id}.general`) ? "❌ Disable Genaral Tickets" : "✅ Enable General Tickets"}`, emoji: "❓" }, { value: "Banner", description: `Change the banner image of the embeds`, emoji: "🖼️" }, { value: "Prefix", description: `Change the prefix of the bot`, emoji: "🤖" }, { value: "Cancel", description: `Cancel the setup`, emoji: "956123182425841705" }, ] //define the selection let Selection = new Discord.MessageSelectMenu() .setCustomId('MenuSelection') .setMaxValues(1) //OPTIONAL, this is how many values you can have at each selection .setMinValues(1) //OPTIONAL , this is how many values you need to have at each selection .setPlaceholder('Click me to setup the system') .addOptions( menuoptions.map(option => { let Obj = { label: option.label ? option.label.substr(0, 50) : option.value.substr(0, 50), value: option.value.substr(0, 50), description: option.description.substr(0, 50), } if(option.emoji) Obj.emoji = option.emoji; return Obj; })) //define the embed let MenuEmbed = new Discord.MessageEmbed() .setAuthor({name : `Ticket Setup`, iconURL: `https://winaero.com/blog/wp-content/uploads/2017/02/Settings-Gear-icon.png`}) .setDescription(`***Setup the ticket using the \`selection\` below***`) let used1 = false; //send the menu msg let menumsg = await message.reply({embeds: [MenuEmbed], components: [new Discord.MessageActionRow().addComponents(Selection)]}) //Create the collector const collector = menumsg.createMessageComponentCollector({ filter: i => i.isSelectMenu() && i.message.author.id == client.user.id && i.user, time: 90000 }) //Menu Collections collector.on('collect', async b => { if(b?.user.id !== message.author.id) return b?.reply({content: "❌ Only the one who typed the Command is allowed to select Things!", ephemeral: true}); let enabled = 0, disabled = 0; for(const value of b?.values) { let oldstate = await client.tickets.get(message.guild.id, `${value.toLowerCase()}`); if(!oldstate) enabled++; else disabled++; await client.tickets.set(message.guild.id, !oldstate, `${value.toLowerCase()}`) } b?.reply(`**\`Enabled ${enabled} Command-Categories\` and \`Disabled ${disabled} Command-Categories\`**`) }) collector.on('end', collected => { msg.edit({content: "❌ Time ran out/Input finished! Cancelled", embeds: [ msg.embeds[0] .setDescription(`${getMenuOptions().map(option => `> ${option.emoji} **${option.value}-Commands**: ${option.description.split(" ")[0] != "❌" ? `\`Are now disabled [❌]\`` : `\`Are now enabled [✅]\``}`).join("\n\n")}`) ], components: []}).catch((e)=>{}) }) }