The Capinetta RP ticket system is a fully self-contained support module located inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Capinetta-RP/capinetta-discord-bot/llms.txt
Use this file to discover all available pages before exploring further.
utils/tickets/. It supports dynamic support categories with custom names, emojis, descriptions, and role assignments. When a panel is posted to a channel, users interact with a button grid to open a private ticket channel. Staff members can claim, transfer, and close tickets through button interactions — and when a ticket closes, the system automatically generates a complete HTML transcript, delivers it to the user by DM, archives it in the configured logs channel, and records the action in the database. Inactivity reminders ping staff when tickets go unanswered, and the /ticket metrics command exposes KPI data on resolution times, volume, and staff productivity.
Setup Flow
Create a ticket category
Run Up to two additional roles can be passed as
/ticket add to define a new support category. You must provide a name, emoji, description, the primary staff role, and the Discord category channel where ticket text channels will be created.rol_extra_1 and rol_extra_2 during creation, or added later with /ticket addrole.Add extra staff roles (optional)
Grant additional roles access to tickets in a specific category:This appends the role to the stored role ID list for that category without replacing existing roles.
Set the logs channel
Configure where closed ticket transcripts and action logs will be posted:This stores
ticketLogsChannel in guild_settings. Without this, transcripts are generated and saved locally but not archived to a Discord channel.Post the support panel
Send the interactive button panel to a public support channel:The bot will ask for confirmation before posting. Once confirmed, it sends an embed with a button for each configured category (up to 3 buttons per row). The panel message ID and channel ID are stored in
guild_settings so the panel auto-updates whenever categories are added, edited, or removed.Ticket Lifecycle
When a user clicks a category button on the panel, thecreate_ticket_ interaction is routed through controllers/router.js → actions.createTicketProcess. The system enforces one open ticket per user — attempting to create a second ticket while one is already open returns an ephemeral error pointing to the existing channel.
Full lifecycle flow:
-
Creation — A private text channel named
ticket-XXXX(zero-padded ID) is created under the category channel. Permission overwrites grant view/send access to the user and all configured staff roles. The general@everyonerole is explicitly denied. - Welcome embed — The bot posts a welcome embed in the new channel with the category emoji, name, and the user’s mention. Three control buttons are attached: Claim, Transfer, and Close.
-
Claim (
claim_ticketbutton) — Any authorized staff member can claim the ticket, assigning it to themselves. The embed updates to show who claimed it, and inactivity timers are cleared. Only the claiming staff member (or roles with TICKET.CLOSE permission) can close a claimed ticket. -
Transfer (
transfer_ticketbutton) — Opens aUserSelectMenuso the current claimant can reassign the ticket to another staff member. The reassignment is recorded viaDB.assignTicketand logged to the ticket logs channel. -
Close (
close_ticketbutton) — Triggers a confirmation prompt. On confirmation (confirm_close):- The inactivity timer is cleared.
- An HTML transcript is generated using
discord-html-transcriptswithlimit: -1(full history) andsaveImages: true. - The HTML file is saved locally to
data/transcripts/ticket-{id}-{timestamp}.html. - The transcript is sent as an attachment to the user’s DMs.
- A close log embed with the transcript attachment is posted to the configured
ticketLogsChannel. - The ticket record is updated in the database with the local transcript filename.
- The channel is deleted after a 5-second delay.
Transcripts are stored on the server’s local filesystem under
data/transcripts/ and served through the web dashboard. Only authenticated staff members with dashboard access can view them via the Tickets section.Inactivity Reminders
After a ticket is created or activity is last recorded, the system schedules two automatic inactivity pings targeting all configured staff roles:| Reminder | Default Delay | Environment Variable |
|---|---|---|
| First reminder | 30 minutes | TICKET_INACTIVITY_WARNING |
| Second reminder | 60 minutes | TICKET_INACTIVITY_RETRY |
ticket- prefixed channel, touchTicketActivity updates the lastActivity timestamp in the database and resets the inactivity timer. If the ticket is claimed or closed before a reminder fires, the timer is cleared automatically.
Ticket Management Commands
All ticket management commands require the Administrator permission.| Command | Description |
|---|---|
/ticket add | Create a new support category with name, emoji, description, roles, and parent Discord category |
/ticket addrole | Append an additional staff role to an existing category |
/ticket edit | Modify any attribute of an existing category (name, emoji, description, roles, parent category) |
/ticket remove | Delete a category. Triggers an automatic panel refresh |
/ticket list | Display all configured categories with their emojis |
/ticket panel | Post the interactive button panel to a specified channel |
/ticket setlogs | Set the channel where transcripts and close logs are archived |
/ticket metrics | Display KPI embed with resolution time, volume by category, and staff ranking |
add, edit, remove) automatically refreshes the live panel message if one has been posted, keeping it in sync without manual intervention.
Ticket Metrics
The/ticket metrics command queries the database and returns a rich embed with three key KPI sections:
⏱️ Avg Resolution Time
Average time from ticket creation to closure, displayed in hours and minutes. Calculated from the
ticket_actions records for the guild.📂 Volume by Category
Total ticket count broken down by support category name, showing which areas generate the most requests.
🏆 Staff Ranking
Top staff members ranked by resolved ticket count, displayed with gold/silver/bronze medals for the top three.
