Initial commit

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
root
2026-02-10 08:22:19 -06:00
commit 519788c633
39 changed files with 17121 additions and 0 deletions

51
utils/ticketComponents.js Normal file
View File

@@ -0,0 +1,51 @@
/**
* Ticket action row builder Close, Claim, Escalate (if tier < 3), Deescalate (if tier >= 2).
* Used by handlers/buttons.js and handlers/commands.js.
*/
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const { CONFIG } = require('../config');
/**
* Build the standard ticket action row (Close, Claim, optionally Escalate, optionally Deescalate).
* @param {Object} ticket - Ticket with escalationTier (0, 1, 2) and optionally escalated
* @param {Object} [options] - { unclaimLabel, unclaimEmoji } for claim button when ticket is claimed
* @returns {ActionRowBuilder}
*/
function getTicketActionRow(ticket, options = {}) {
const tier = ticket.escalationTier ?? (ticket.escalated ? 1 : 0);
const row = new ActionRowBuilder();
row.addComponents(
new ButtonBuilder()
.setCustomId('close_ticket')
.setLabel(CONFIG.BUTTON_LABEL_CLOSE)
.setEmoji(CONFIG.BUTTON_EMOJI_CLOSE)
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('claim_ticket')
.setLabel(options.unclaimLabel ?? CONFIG.BUTTON_LABEL_CLAIM)
.setEmoji(options.unclaimEmoji ?? CONFIG.BUTTON_EMOJI_CLAIM)
.setStyle(ButtonStyle.Secondary)
);
if (tier < 2) {
row.addComponents(
new ButtonBuilder()
.setCustomId('escalate_ticket')
.setLabel('Escalate')
.setStyle(ButtonStyle.Secondary)
);
}
if (tier >= 1) {
row.addComponents(
new ButtonBuilder()
.setCustomId('deescalate_ticket')
.setLabel('Deescalate')
.setStyle(ButtonStyle.Secondary)
);
}
return row;
}
module.exports = { getTicketActionRow };