diff --git a/src/commands/tickets/ticket.js b/src/commands/tickets/ticket.js new file mode 100644 index 0000000..085b8c3 --- /dev/null +++ b/src/commands/tickets/ticket.js @@ -0,0 +1,43 @@ +import { SlashCommandBuilder } from 'discord.js'; +import { ACCESS_LEVELS, TICKET_CATEGORIES } from '../../config/constants.js'; +import { notImplementedEmbed } from '../../ui/embeds.js'; + +export const access = ACCESS_LEVELS.USER; +// `close` is also allowed for the ticket author: checked in the ticket service. +export const subcommandAccess = { claim: ACCESS_LEVELS.STAFF, add: ACCESS_LEVELS.STAFF }; + +export const data = new SlashCommandBuilder() + .setName('ticket') + .setDescription('Tickets de support privés') + .addSubcommand((sub) => + sub + .setName('create') + .setDescription('Ouvrir un ticket') + .addStringOption((option) => + option + .setName('category') + .setDescription('Catégorie du ticket') + .setRequired(true) + .addChoices(...TICKET_CATEGORIES.map(({ id, label }) => ({ name: label, value: id }))), + ), + ) + .addSubcommand((sub) => + sub + .setName('close') + .setDescription('Fermer le ticket') + .addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500)), + ) + .addSubcommand((sub) => sub.setName('claim').setDescription('Prendre le ticket en charge')) + .addSubcommand((sub) => + sub + .setName('add') + .setDescription('Ajouter un participant') + .addUserOption((option) => option.setName('user').setDescription('Membre à ajouter').setRequired(true)), + ); + +// TODO(M6-T03..T09): implement with a ticket service backed by the tickets table. +export async function execute(interaction) { + await interaction.reply({ + embeds: [notImplementedEmbed(`/ticket ${interaction.options.getSubcommand()}`)], + }); +}