const { SlashCommandBuilder } = require('@discordjs/builders'); module.exports = { data: new SlashCommandBuilder() .setName('close') .setDescription('Closes the ticket'), async execute(interaction) { if (!interaction.channel.name.startsWith('ticket-')) { return interaction.reply('You can only use this command inside a ticket channel.'); } const ticketInfo = interaction.client.tickets[interaction.channel.id]; const hasPermission = ticketInfo.user === interaction.user.id || interaction.member.roles.cache.has(interaction.client.config.role_id) || interaction.client.config.authorized_users.includes(interaction.user.id); if (!hasPermission) { return interaction.reply('You do not have permission to close this ticket.'); } await interaction.channel.delete(); delete interaction.client.tickets[interaction.channel.id]; } };