simplify: rename CONFIG channels, dedup hasStaffRole, drop enforceEmbedLimit
- Rename CONFIG.TRANSCRIPT_CHAN -> CONFIG.TRANSCRIPT_CHANNEL_ID and CONFIG.LOG_CHAN -> CONFIG.LOGGING_CHANNEL_ID across 9 callsites so CONFIG keys match their .env names — no more "grep .env, find nothing" for new readers - Replace handlers/commands.js#hasStaffRole with utils.js#isStaff (was a verbatim copy) - Delete utils.js#enforceEmbedLimit and its 2 callsites; both inputs are bounded well under the 6000-char Discord embed cap, so the trim was defensive code that never fired Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ const { CONFIG } = require('../config');
|
||||
const { makeTicketName, resolveCreatorNickname, getOrCreateTicketCategory, cleanupEmptyOverflowCategory, checkTicketCreationRateLimit, toDiscordSafeName } = require('../services/tickets');
|
||||
const { sendTicketClosedEmail } = require('../services/gmail');
|
||||
const { getTicketActionRow } = require('../utils/ticketComponents');
|
||||
const { sanitizeEmbedText, truncateEmbedDescription, enforceEmbedLimit } = require('../utils');
|
||||
const { sanitizeEmbedText, truncateEmbedDescription } = require('../utils');
|
||||
const { enqueueRename, enqueueSend } = require('../services/channelQueue');
|
||||
const { runEscalation, runDeescalation } = require('./commands');
|
||||
const { pendingCloses } = require('./pendingCloses');
|
||||
@@ -470,7 +470,7 @@ async function handleConfirmClose(interaction, ticket, sendEmail = true) {
|
||||
await enqueueSend(interaction.channel, discordCloseContent);
|
||||
|
||||
const transcriptChan = await interaction.client.channels
|
||||
.fetch(CONFIG.TRANSCRIPT_CHAN)
|
||||
.fetch(CONFIG.TRANSCRIPT_CHANNEL_ID)
|
||||
.catch(() => null);
|
||||
let transcriptMsg = null;
|
||||
|
||||
@@ -516,7 +516,7 @@ async function handleConfirmClose(interaction, ticket, sendEmail = true) {
|
||||
}
|
||||
|
||||
const logChan = await interaction.client.channels
|
||||
.fetch(CONFIG.LOG_CHAN)
|
||||
.fetch(CONFIG.LOGGING_CHANNEL_ID)
|
||||
.catch(() => null);
|
||||
if (logChan) {
|
||||
const closerMention = interaction.user.toString();
|
||||
@@ -682,7 +682,6 @@ async function handleTicketModal(interaction) {
|
||||
|
||||
const actionRow = getTicketActionRow({ escalationTier: 0 });
|
||||
|
||||
enforceEmbedLimit([welcomeEmbed, infoEmbed, resourcesEmbed]);
|
||||
let welcomeMsg;
|
||||
try {
|
||||
welcomeMsg = await enqueueSend(channel, {
|
||||
@@ -709,7 +708,7 @@ async function handleTicketModal(interaction) {
|
||||
|
||||
await interaction.deleteReply().catch(() => {});
|
||||
|
||||
const logChan = await interaction.client.channels.fetch(CONFIG.LOG_CHAN).catch(() => null);
|
||||
const logChan = await interaction.client.channels.fetch(CONFIG.LOGGING_CHANNEL_ID).catch(() => null);
|
||||
if (logChan) {
|
||||
await enqueueSend(logChan,
|
||||
`📝 ${channel.name} created by ${interaction.user.tag}`
|
||||
|
||||
Reference in New Issue
Block a user