From eecfde1568ed6a67cb72dcb9fe5b7e1e6454a110 Mon Sep 17 00:00:00 2001 From: Nix Krystik Date: Thu, 8 Oct 2026 23:05:20 +0800 Subject: [PATCH] (buttons): Ticket threads now prefix `[CLOSED]`. This applies to both tickets closed manually & tickets closed after 5 days of inactivity. --- src/buttons/close-mod-ticket.ts | 1 + src/buttons/close-ticket.ts | 1 + src/utils/private-help-utils.ts | 14 +++++++------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/buttons/close-mod-ticket.ts b/src/buttons/close-mod-ticket.ts index aa42cda..cff3382 100644 --- a/src/buttons/close-mod-ticket.ts +++ b/src/buttons/close-mod-ticket.ts @@ -24,6 +24,7 @@ export default { await interaction.editReply({ content: 'Ticket closed.' }); channel.edit({ + name: `[CLOSED] ${channel.name}`, archived: true, locked: true }); diff --git a/src/buttons/close-ticket.ts b/src/buttons/close-ticket.ts index d6a9fd0..85cbb8e 100644 --- a/src/buttons/close-ticket.ts +++ b/src/buttons/close-ticket.ts @@ -21,6 +21,7 @@ export default { await interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Ticket closed.' }); channel.edit({ + name: `[CLOSED] ${channel.name}`, archived: true, locked: true }); diff --git a/src/utils/private-help-utils.ts b/src/utils/private-help-utils.ts index e1b2903..8dd3fed 100644 --- a/src/utils/private-help-utils.ts +++ b/src/utils/private-help-utils.ts @@ -13,23 +13,23 @@ export async function closeOldTickets(client: Client) { await thread.send('This ticket has been closed due to inactivity.'); thread.edit({ + name: `[CLOSED] ${thread.name}`, archived: true, locked: true }); } } catch (e) { - console.error('Error closing ticket due to inactivity:'); - console.error(e); + console.error('Error closing ticket due to inactivity:', e); } } } export async function createPrivateHelpTicketThread(client: Client, guild: Guild, creator: GuildMember | null, reason: string, customTitle: string = '', additionalMembersToAdd: string[] = []): Promise { - const guildSettings = await Database.getOrCreateSettings(guild.id); + const settings = await Database.getOrCreateSettings(guild.id); - if (!guildSettings || !guildSettings.private_help_channel_id || !guildSettings.private_help_role_id) return null; + if (!settings.private_help_channel_id || !settings.private_help_role_id) return null; - const channel = await client.channels.fetch(guildSettings.private_help_channel_id) as TextChannel; + const channel = await client.channels.fetch(settings.private_help_channel_id) as TextChannel; const thread = await channel.threads.create({ name: customTitle ? customTitle : (creator ? `${creator.displayName}'s Ticket` : 'Mod Ticket'), @@ -54,11 +54,11 @@ export async function createPrivateHelpTicketThread(client: Client, guild: Guild const row = new ActionRowBuilder().addComponents(closeButton, claimButton); await thread.send({ - content: `${creator} feel free to direct your questions at any <@&${guildSettings.private_help_role_id}>. Only you and staff members can see this channel.\n\n**Reason for contact:**\n${reason}\n\n-# Tickets will automatically close after 5 days of inactivity.`, + content: `${creator} feel free to direct your questions at any <@&${settings.private_help_role_id}>. Only you and staff members can see this channel.\n\n**Reason for contact:**\n${reason}\n\n-# Tickets will automatically close after 5 days of inactivity.`, components: [row], allowedMentions: { users: [creator.id], - roles: [guildSettings.private_help_role_id] + roles: [settings.private_help_role_id] } }); } else {