Untitled
unknown
javascript
a year ago
1.2 kB
10
Indexable
const { SlashCommandBuilder } = require("discord.js"); module.exports = { data: new SlashCommandBuilder() .setName("ticket") .setDescription("Open a support ticket"), async execute(interaction) { try { const ticketChannel = await interaction.guild.channels.create(`ticket-${interaction.user.id}`, { type: "text", reason: "Creating a support ticket", permissionOverwrites: [ { id: interaction.guild.id, deny: ["VIEW_CHANNEL"], }, { id: interaction.user.id, allow: ["VIEW_CHANNEL"], }, ], }); await ticketChannel.send(`Welcome to your support ticket, ${interaction.user}!`); await interaction.reply({ content: `Your support ticket has been created in ${ticketChannel}.`, ephemeral: true, }); } catch (error) { console.error("Error creating support ticket:", error); await interaction.reply({ content: "An error occurred while creating the support ticket. Please contact the server administrators.", ephemeral: true, }); } }, };
Editor is loading...
Leave a Comment