import { SlashCommandBuilder, ChatInputCommandInteraction } from 'discord.js'; import { SlashCommand } from '../../utils/types.js'; import { prisma } from '../../database/index.js'; const command: SlashCommand = { guildOnly: true, data: new SlashCommandBuilder() .setName('ticketstatus') .setDescription('Ändert den Status des aktuellen Tickets.') .addStringOption((opt) => opt .setName('status') .setDescription('Neuer Status') .addChoices( { name: 'Offen', value: 'open' }, { name: 'In Bearbeitung', value: 'in-progress' }, { name: 'Geschlossen', value: 'closed' } ) .setRequired(true) ), async execute(interaction: ChatInputCommandInteraction) { const status = interaction.options.getString('status', true) as 'open' | 'in-progress' | 'closed'; const ticket = await prisma.ticket.findFirst({ where: { channelId: interaction.channelId } }); if (!ticket) { await interaction.reply({ content: 'Kein Ticket in diesem Kanal.', ephemeral: true }); return; } await prisma.ticket.update({ where: { id: ticket.id }, data: { status } }); await interaction.reply({ content: `Ticket-Status geändert zu **${status}**.` }); } }; export default command;