feat(tickets): open tickets from a panel button in any channel
CI / quality (push) Has been cancelled
CI / quality (push) Has been cancelled
Members had to know `/ticket create` and its category list to reach support, so the entry point is now a panel: `/ticket setup` publishes it in the current channel, the button opens a menu of the categories the member is allowed to open, and the choice creates the ticket. The panel channel and message are stored in `ticket_panels`, so a reinstall replaces the previous message instead of leaving the server two entry points, and the panel survives a restart.
This commit is contained in:
9 files changed
+492
-29
No files matched your search
@@ -5,12 +5,19 @@ import {
|
||||
claimTicket,
|
||||
closeTicket,
|
||||
createTicket,
|
||||
removePanel,
|
||||
setupPanel,
|
||||
} from '../../services/tickets/ticket-service.js';
|
||||
import { successEmbed } 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 subcommandAccess = {
|
||||
claim: ACCESS_LEVELS.STAFF,
|
||||
add: ACCESS_LEVELS.STAFF,
|
||||
setup: ACCESS_LEVELS.STAFF,
|
||||
'setup-remove': ACCESS_LEVELS.STAFF,
|
||||
};
|
||||
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('ticket')
|
||||
@@ -33,6 +40,10 @@ export const data = new SlashCommandBuilder()
|
||||
.setDescription('Fermer le ticket')
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500)),
|
||||
)
|
||||
.addSubcommand((sub) =>
|
||||
sub.setName('setup').setDescription('Publier le panneau d’ouverture de ticket dans ce salon'),
|
||||
)
|
||||
.addSubcommand((sub) => sub.setName('setup-remove').setDescription('Retirer le panneau de ce salon'))
|
||||
.addSubcommand((sub) => sub.setName('claim').setDescription('Prendre le ticket en charge'))
|
||||
.addSubcommand((sub) =>
|
||||
sub
|
||||
@@ -60,6 +71,12 @@ export async function execute(interaction) {
|
||||
case 'close':
|
||||
await closeTicket(interaction, interaction.options.getString('reason'));
|
||||
return;
|
||||
case 'setup':
|
||||
await setupPanel(interaction);
|
||||
return;
|
||||
case 'setup-remove':
|
||||
await removePanel(interaction);
|
||||
return;
|
||||
case 'claim':
|
||||
await claimTicket(interaction);
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user