client.on('interactionCreate', async interaction => { if (!interaction.isButton()) return; if (interaction.customId == 'fecharticket') { if (!interaction.member.roles.cache.has("1118825118253207682")) { return interaction.reply({ content: "Non hai il permesso", ephemeral: true }); } let channel2 = interaction.message.channel.topic.split("・")[1]; const user6 = client.users.cache.get(channel2); await interaction.channel.permissionOverwrites.set([ { id: user6.id, deny: ['SEND_MESSAGES', 'VIEW_CHANNEL'], }, { id: interaction.guild.roles.cache.get('1118825118253207682').id, allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'], }, { id: interaction.guild.id, deny: ['VIEW_CHANNEL'], }, ]); await interaction.channel.setName(`⛔・Chiusura-ticket`); const chiuso = new MessageEmbed() .setColor("2f3136") .setDescription(`Il Ticket verrà chiuso da <@${interaction.user.id}>`); const ticketc = new MessageButton() .setLabel('Conferma chiusura') .setStyle('SECONDARY') .setCustomId('fcticket') .setEmoji('1167907066204127253'); const bt = new MessageActionRow().addComponents(ticketc); await interaction.reply({ embeds: [chiuso], components: [bt] }); } });