feat(tickets): open tickets from a panel button in any channel
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:
BlackAngelTV committed 2026-10-02 20:29:22 +02:00
1 parent 1310840215
commit ed14b8260c
9 files changed
+492 -29

No files matched your search

+37 -1
View File
@@ -1,4 +1,10 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder } from 'discord.js';
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
StringSelectMenuBuilder,
UserSelectMenuBuilder,
} from 'discord.js';
/** Discord label and custom id limits. */
const LABEL_MAX = 80;
@@ -97,3 +103,33 @@ export function pollButtons(pollId, choices) {
}
return rows;
}
/** Button of the ticket panel posted by `/ticket setup`. */
export function ticketPanelButton() {
return [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId('ticket:panel:open')
.setLabel('Ouvrir un ticket')
.setStyle(ButtonStyle.Primary),
),
];
}
/** Category chooser shown after pressing the panel button, limited to the member's level. */
export function ticketCategorySelect(categories) {
return [
new ActionRowBuilder().addComponents(
new StringSelectMenuBuilder()
.setCustomId('ticket:panel:pick')
.setPlaceholder('Dans quelle catégorie ?')
.addOptions(
categories.map(({ id, label, description }) => ({
label,
value: id,
description,
})),
),
),
];
}