import { SlashCommandBuilder, ChatInputCommandInteraction } from 'discord.js';
import { SlashCommand } from '../../utils/types';
import { context } from '../../config/context';

const command: SlashCommand = {
  guildOnly: true,
  data: new SlashCommandBuilder().setName('claim').setDescription('Übernimmt das aktuelle Ticket.'),
  async execute(interaction: ChatInputCommandInteraction) {
    const ok = await context.tickets.claimTicket(interaction);
    if (!ok) {
      await interaction.reply({ content: 'Kein Ticket in diesem Kanal gefunden.', ephemeral: true });
      return;
    }
    await interaction.reply({ content: 'Ticket übernommen.' });
  }
};

export default command;
